Skip to content
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

Read architecture from node-gyp correctly #491

Merged
merged 3 commits into from
May 16, 2020

Conversation

dbkr
Copy link
Contributor

@dbkr dbkr commented Feb 18, 2020

Reads the target architecture from the output of node-gyp build which prints the target architecture rather than the 'using' string that node-gyp prints (which is the platform it's running on).

This allows neon projects to build on platforms where the host's node binary is of a different architecture to the target architecture (eg. on Windows when building for x86 on an x64 host, even if using native x86 toolchains).

Fixes #490

dbkr added 2 commits February 18, 2020 15:15
It was executing node-gyp configure and trying to read the arch
from the output, but was doing so by looking at a string that
printed was platform gyp was running on rather than the target
platform. node-gyp --build does output the target architecture
though, so parse it from that.
@@ -164,18 +164,19 @@ mod build {
}

if cfg!(windows) {
let node_gyp_output = String::from_utf8_lossy(&output.stderr);
println!("cargo:node_arch={}", parse_node_arch(&node_gyp_output));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_gyp_output no longer exists. Does it need to be passed into this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops - that line shouldn't have been deleted - fixed. (For complex dependency reasons I had to backport the fix to 0.3.x to test it and had to manually merge as the indenting level had changed, so must have missed this one).

@kjvalencik
Copy link
Member

@dbkr Thanks for contributing a fix! Can you take a look at the build failures? Thanks!

That line needs to stay for the root dir / lib file
@dbkr
Copy link
Contributor Author

dbkr commented Mar 3, 2020

Hi - is anything further needed from me on this? We'd like to start releasing builds soon so are very keen for #490 to be fixed, otherwise we'll have to find a workaround.

@kjvalencik
Copy link
Member

@dherman can you take a look at this? I'm not familiar enough with this code to review.

Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Architecture read from node-gyp incorrectly
3 participants