-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Update documentation for RuntimeLibrary [help required] (was: How do I set the RuntimeLibrary to /MT (MT_StaticRelease)?) #1686
Comments
Did you find a solution? I'm facing the same issue. :/ |
@sdasun no I never figured it out. I ended up not linking against a static library (which I was building) and instead just have node-gyp do the compiling of my source. |
Thank you for quick response. I have three different projects, probably
will not easy to combine those three. Will investigate more and let you
know if I find anything.
|
@iffy It turned out that my library actually was MD though I've given a compiler directive on the configuration file. Forcing to add /MT modifier to the compiler did the trick. At least for my case. |
Help in documenting this will be appreciated.This is the snippet needed in your
Because {
'target_defaults': {
'configurations': {
'Debug': {
'msvs_settings': {
'VCCLCompilerTool': {
# 0 - MultiThreaded (/MT)
# 1 - MultiThreadedDebug (/MTd)
# 2 - MultiThreadedDLL (/MD)
# 3 - MultiThreadedDebugDLL (/MDd)
'RuntimeLibrary': 1,
}
}
},
'Release': {
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': 0, # shared release
},
},
},
},
},
} |
I'm going to close this because it's been inactive for a long time and because it's not a really a node-gyp issue (as in: it's not a node-gyp bug report, it's a question of how do I do something with node-gyp - nodejs/help is a more appropriate place for that.) Having said all that, mixing CRTs is almost never what you want to do, that's a recipe for disaster. For example, you can't |
@bnoordhuis, @refack in fact, when using Nan, which is mostly C++ templates will use the same heap as the module, but when allocating What is even more surprising is that when using the debug version ( (look at this discussion: https://docs.microsoft.com/en-us/answers/questions/240332/assert-when-using-mtd-dynamic-library.html) |
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86
Verbose output (from npm or node-gyp):
I'm trying to compile my own native add-on. I'm trying to link against a static library. On macOS and Linux it works fine, but on Windows, I'm getting this error:
When I search the Internet, it seems like everyone else's versions of this error has
MT_StaticRelease
andMD_DynamicRelease
switched. That is, it seems like the default for everyone else isMT_StaticRelease
but for me it'sMD_DynamicRelease
.MD_DynamicRelease
and how can I make it instead build withMT_StaticRelease
?MD_DynamicRelease
, so once I fix this error am I going to have the opposite problem with Electron?build/config.gypi
includes"node_shared": "false",
But you can see from the verbose build output thatCL.exe
is being called with/MD
rather than/MT
. I've tried all kinds of variations of msvs_settings.VCCLCompilerTool.RuntimeLibrary but it seems to have no effect.As a side question, what would it take to remove node's dependence on GYP? Is a pure-JavaScript build system possible? Or is that a chicken-and-egg problem that can't be solved?
binding.gyp
The text was updated successfully, but these errors were encountered: