Skip to content

Win-version-info prebuildify seems incompatible with cross-platform prebuilds #29

@pimterry

Description

@pimterry

I build a Windows package on Linux, by setting npm_config_platform and npm_config_target_platform both to win32.

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 to win32, skip.js exits with 1, so that the node-gyp-build script runs. That command then builds for Linux though, not Windows, ignoring the npm_config_platform setting, and resulting in an install including a Linux binary that can't be loaded on Windows.

To reproduce, on Linux:

export npm_config_platform=win32

npm install win-version-info

file node_modules/win-version-info/build/Release/VersionInfo.node
# Prints:
# node_modules/win-version-info/build/Release/VersionInfo.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=9ae95691ae49675006d9df3d36477aa4fede57be, not stripped

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions