node-gyp
node-gyp copied to clipboard
Strange Windows node.lib download behavior
- Node Version: v12.x-v16.x
- Platform: Windows
- Compiler: VS2019
- Module: n/a
Verbose output (from npm or node-gyp):
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.7.9 found at "C:\hostedtoolcache\windows\Python\3.7.9\x64\python3.exe"
gyp http GET https://nodejs.org/download/release/v16.11.0/node-v16.11.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.11.0/node-v16.11.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.11.0/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v16.11.0/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v16.11.0/win-x64/node.lib
gyp http GET https://nodejs.org/download/release/v16.11.0/win-arm64/node.lib
gyp http 200 https://nodejs.org/download/release/v16.11.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.11.0/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v16.11.0/win-x86/node.lib
gyp http 404 https://nodejs.org/download/release/v16.11.0/win-arm64/node.lib
gyp info find VS using VS2019 (16.11.31702.278) found at:
(...)
So there are two issues here it seems:
-
win-arm64
is non-existent and always results in a 404, even with prior node versions (it's not just a delay in the publishing of the lib file). I'm not sure if this an issue for nodejs/build or if node-gyp should stop attempting to download win-arm64 lib files until they start to be published? - Why is node-gyp downloading lib files for other Windows architectures anyway, not just arm64 but even x86 on an x64 system? Is there some way to prevent that?
-
win-arm64
is occasionally available, but mostly if you're pointing node-gyp to unofficial-builds.nodejs.org where we have sporadic win-arm64 builds. It's also in anticipation of having them regularly built in our release pipeline but that has to wait until we get stable build machines and not laptops on peoples desks. - tbh I don't recall the reasoning behind downloading them all, but it's what node-gyp has always done as far as I can remember: https://github.com/nodejs/node-gyp/blob/b05b4fe9891f718f40edf547e9b50e982826d48a/lib/install.js#L234 - I think perhaps one reason is that it's reasonable to have an addon build that does an x86 compile on an x64 windows, and if you don't have the lib for that scenario then you're in trouble. The arm64 one is harder to justify and we've probably just added it in to the existing list of 2 because that's easy (I think? unless Windows has some clever cross compile stuff going on like macOS).
There might be a case for doing something more intelligent here but we're in a bit of a Chesterson's Fence situation—if we change it, we (well I) really don't have a good idea of what we might be breaking until someone yelps. If these .lib files are getting particularly big and onerous then maybe we could trial an alternative approach.
Really need some smarts from @nodejs/platform-windows I think; maybe someone else has more history in their head than I on this front.
It seems like node-gyp should know in advance which architecture it's compiling for?
This issue seems no longer relevant as it uses a no longer supported version of Node and has been stale for a long time. If there are no objections, I will close this issue next Mon-Tue. In case something similar happens again please open a new issue.
In addition, node-gyp now only downloads the architecture it needs, thanks to the changes in https://github.com/nodejs/node-gyp/commit/7a3fe1c4373fca5ab2b2807bb059260a950c5c84