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

Avoid copying around node.lib on Windows #537

Closed
wants to merge 1 commit into from

Conversation

corsix
Copy link

@corsix corsix commented Nov 20, 2014

Imagine a Jenkins build server, where node-gyp chooses a dev dir of say C:\Users\jenkins\.node-gyp\0.10.29\. The build server runs multiple build jobs in parallel, each with disjoint working directories, but sharing global state such as the node-gyp dev dir. Some of these build jobs are using node-gyp to build 32-bit binaries, and some are using node-gyp to build 64-bit binaries. Sometimes the following scenario could previously occur:

  1. Job A step 1: Copy C:\Users\jenkins\.node-gyp\0.10.29\ia32\node.lib to C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib
  2. Job B step 1: Copy C:\Users\jenkins\.node-gyp\0.10.29\x64\node.lib to C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib
  3. Job B step 2: Successfully build and link a 64-bit binary.
  4. Job A step 2: Attempt to build and link a 32-bit binary, but fail because C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib is of the wrong architecture.

This commit avoids the above scenario by making the dev dir immutable, and making the generated vcxproj files refer directly to the node.lib file for the appropriate architecture.


This is rather similar to #443 / #450.

Imagine a Jenkins build server, where node-gyp chooses a dev dir of say `C:\Users\jenkins\.node-gyp\0.10.29\`. The build server runs multiple build jobs in parallel, each with disjoint working directories, but sharing global state such as the node-gyp dev dir. Some of these build jobs are using node-gyp to build 32-bit binaries, and some are using node-gyp to build 64-bit binaries. Sometimes the following scenario could previously occur:
  1. Job A step 1: Copy `C:\Users\jenkins\.node-gyp\0.10.29\ia32\node.lib` to `C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib`
  2. Job B step 1: Copy `C:\Users\jenkins\.node-gyp\0.10.29\x64\node.lib` to `C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib`
  3. Job B step 2: Successfully build and link a 64-bit binary.
  4. Job A step 2: Attempt to build and link a 32-bit binary, but fail because `C:\Users\jenkins\.node-gyp\0.10.29\Release\node.lib` is of the wrong architecture.

This commit avoids the above scenario by making the dev dir immutable, and making the generated vcxproj files refer directly to the node.lib file for the appropriate architecture.
@saper
Copy link
Contributor

saper commented Jan 8, 2016

How would that work when compiling for both Debug and Release configurations?

Would adding --node-dir to the node-gyp invocation help your Jenkins case?

@bnoordhuis
Copy link
Member

I'll close, there are fresher pull requests that address this.

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

Successfully merging this pull request may close these issues.

4 participants