-
Notifications
You must be signed in to change notification settings - Fork 287
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
Get neon building on windows #122
Conversation
5c266ee
to
01d187c
Compare
f1a95d9
to
6a4bc75
Compare
6a4bc75
to
fc09605
Compare
For some reason, node-gyp never exits if we run `npm` commands without the `--silent` option. Passing `--no-progress --no-color` and/or capturing the output of stderr and stdout doesn't help. This will still make the npm commands fail in case something goes wrong, and won't suppress the node-gyp output when running cargo in verbose mode.
...because they were preventing `neon_sys` functions from being included into the `neon_sys` object file on Windows. Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
9564ef4
to
10273d4
Compare
Other platforms support dynamic lookup of symbols. On Windows, however, we always need to provide a .lib file with the node headers when linking the final dynamic library that will be used by Node applications. Signed-off-by: Nathan Sobo <nathan@github.com>
This fixes link errors when compiling against 32-bit Node on Windows. Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
beccbcb
to
5af3a5a
Compare
The alignof operator is not implemented in older versions of MSVC
Apparently, on Windows, cargo capitalizes all the environment variables passed from the outside. Node-gyp, however, reads them in a case-sensitive way, thus forcing us to downcase them before running it.
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
...because on newer Electron versions node-gyp stores the library as `iojs.lib` and not as `node.lib`.
@maxbrunsfeld Would you be up for joining the Slack and chatting some time? I want to merge this amazing work but it probably needs a little coordination. |
@maxbrunsfeld I guess my main question right now is whether this PR obsoletes #123? |
OK I spent a bunch of time understanding this PR, and I think I will split it into 7 separate PRs, in this order: Consistent calling convention
Windows compilation issues
Windows path issues
Windows npm issues (depends on: Windows path issues)
Windows linker issues (depends on: Windows npm issues, neon-bindings/neon-cli#32)
Windows node-gyp issues
AppVeyor
I intend to preserve the authors, but splitting the work up in these chunks will help me to understand how it all works as well as to ensure CI keeps passing as we go along. |
OK, all the commits in this PR have landed, so I'm going ahead and closing. Thank you to @as-cii, @nathansobo, @maxbrunsfeld, and @EdShaw, so much! I never would've figured this out on my own. |
Summary of changes
The explicit destructor call in
NeonSys_Scope_Exit
was causing a linker error with MSBuild 14.0.It looks like when MSVC compiles these types of explicit destructor calls, it emits a call to
operator delete
, even whendelete
isn't being used in the source. This causes the above linker error becausev8::HandleScope::operator delete
is private. Switching to the static method syntax seems to work around this problem.The
extern "system"
calling convention specifier was preventingneon-sys
from linking correctly in 32-bit windows builds. According to Rust's foreign calling convention docs:I believe that since the functions defined in
neon.cc
are marked asextern "C"
, they can always be linked into rust via the"C"
calling convention, regardless of target.In the neon-sys build script, we run
npm
asnpm.cmd
, and look for theneon.obj
file in a different folder.On windows, native node modules that use
neon
need to link againstnode.lib
, similarly to how C++ modules built withnode-gyp
do so. To do this,neon-sys
needs to capture the location ofnode.lib
at build time, and modules that use neon must contain a build script that supplies this location to the linker.Since this
build.rs
file must be included in every module that uses neon, we've added code to generate this file as part ofneon new
: Support windows neon-cli#32.I've added an
appveyor.yml
that tests neon on both 64 and 32-bit architectures. As you can see on our fork, the 64 bit build passes. Unfortunately, the 32 bit build fails because it is using the currently-published version ofneon-cli
which does not handle building 32-bit modules on a 64-bit system. Once Support windows neon-cli#32 is merged and a newneon-cli
is published, this build will pass.