You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And the target_defaults field does inherit from process.config for the reason that the build configurations of the running node executable may be different from the target being compiled for:
// don't inherit the "defaults" from node's `process.config` object.
// doing so could cause problems in cases where the `node` executable was
// compiled on a different machine (with different lib/include paths) than
// the machine where the addon is being built to
defaults.cflags=[]
defaults.defines=[]
defaults.include_dirs=[]
defaults.libraries=[]
However the variables field also belongs to build configurations of Node.js, and should be treated the same with target_defaults, for example Node.js executable compiled with v8_enable_pointer_compression=1 can not load modules compiled with v8_enable_pointer_compression=0.
This has been causing problems when compiling modules for Electron, because node-gyp is using process.config.variables of the running node executable for compilation, which are different from the build configurations of Electron.
So the generated config.gypi file should not inherit from process.config at all, and it should inherit from the $nodedir/include/node/config.gypi file instead, which is the actual build configuration of the target.
I can start working out a pull request if the above suggested solution sounds good to the maintainers.
@zcbenz I'm inclined to trust you on this and say go ahead and submit a PR and we'll see if we can figure out what the blast radius of such a change might be. Maybe it's just a semver-major to be safe if we can't find evidence of a major impact.
Any input from other @nodejs/gyp heads would be good head (tbh my mental bandwidth on this is a bit limited at the moment).
Currently the
variables
field of the generatedconfig.gypi
file inherits fromprocess.config
:node-gyp/lib/configure.js
Lines 101 to 103 in 5f1a06c
And the
target_defaults
field does inherit fromprocess.config
for the reason that the build configurations of the runningnode
executable may be different from the target being compiled for:node-gyp/lib/configure.js
Lines 115 to 122 in 5f1a06c
However the
variables
field also belongs to build configurations of Node.js, and should be treated the same withtarget_defaults
, for example Node.js executable compiled withv8_enable_pointer_compression=1
can not load modules compiled withv8_enable_pointer_compression=0
.This has been causing problems when compiling modules for Electron, because node-gyp is using
process.config.variables
of the runningnode
executable for compilation, which are different from the build configurations of Electron.So the generated
config.gypi
file should not inherit fromprocess.config
at all, and it should inherit from the$nodedir/include/node/config.gypi
file instead, which is the actual build configuration of the target.I can start working out a pull request if the above suggested solution sounds good to the maintainers.
/cc @rvagg
The text was updated successfully, but these errors were encountered: