-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Win-version-info prebuildify seems incompatible with cross-platform prebuilds #29
Comments
I think I've found a workaround, though it's undocumented and feels weird. Looking closely at https://github.com/prebuild/node-gyp-build/blob/28b562f593ed2d0f3a1dcca4ee781f36d4b20e21/build-test.js, it seems I can make that succeed (and so skip builds) by setting an env var with the package name - i.e. The node-gyp-build docs don't mention anything about this though, and I'm surprised that env var doesn't have a name that implies this behaviour at all... Is this a reasonable solution? In the above repro, this skips the build so that |
To make sure I understand, you previously relied on If so, the thing getting in your way is that
|
Yes exactly - I'm cross-building my application overall, but the expectation is that every dependency will be prebuilt, there shouldn't generally be any native compilation. If cross-compiling worked then this build would have succeeded (because on Linux it would've built a Windows-compatible binary, which would then work at runtime) but using the existing correct prebuild is even better.
Yes, exactly, this is one dependency of many in a complex codebase, I'm aiming for a focused fix with without other side-effects like that.
I think this would be a good result. A per-package solution is useful here - maybe the env var value could be a list of packages where it should be skipped, comma-separated? Like An even better result could be changing the check, instead of skipping it completely: instead of testing a full Maybe that should actually be the default if |
It makes sense to skip the |
I build a Windows package on Linux, by setting
npm_config_platform
andnpm_config_target_platform
both towin32
.Until recently this worked fine, but I've just updated win-version-info to v5.0.1 from v3 (i.e. upgrading to the prebuildify release) and this no longer works correctly.
When
npm_config_platform
is set towin32
, skip.js exits with 1, so that thenode-gyp-build
script runs. That command then builds for Linux though, not Windows, ignoring thenpm_config_platform
setting, and resulting in an install including a Linux binary that can't be loaded on Windows.To reproduce, on Linux:
Despite building for Windows, this is an Linux binary. That file command should print something like "PE32+ executable (DLL) (GUI) x86-64, for MS Windows".
I'm currently investigating setting
PREBUILDS_ONLY
at runtime, which would work around this by shipping a Linux build on Windows and then ignoring it, but it seems like a bit of a hack - it would be preferably to skip the unnecessary build to avoid shipping an unusable binary, and if I ever add another module where I do want to allow non-built binaries to be used then I'll be completely stuck.Any ideas?
The text was updated successfully, but these errors were encountered: