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

gyp: name 'build_v8_with_gn' is not defined #10

Closed
josephg opened this issue Apr 29, 2018 · 11 comments
Closed

gyp: name 'build_v8_with_gn' is not defined #10

josephg opened this issue Apr 29, 2018 · 11 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@josephg
Copy link

josephg commented Apr 29, 2018

I'm seeing this occasional error while trying to prebuildify:

gyp: name 'build_v8_with_gn' is not defined while evaluating condition 'build_v8_with_gn == "true"' in binding.gyp while trying to load binding.gyp

It only shows up sometimes, though I can reproduce it reliably using a clean checkout of turbo-net. Full stack below:

sephsmac:turbo-net josephg$ prebuildify --napi
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@9.11.1 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/josephg/.nvm/versions/node/v9.11.1/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/josephg/3rdparty/turbo-net/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/josephg/.nvm/versions/node/v9.11.1/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/josephg/.node-gyp/10.0.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/josephg/.node-gyp/10.0.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/josephg/.nvm/versions/node/v9.11.1/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/josephg/.node-gyp/10.0.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/josephg/3rdparty/turbo-net',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: name 'build_v8_with_gn' is not defined while evaluating condition 'build_v8_with_gn == "true"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/josephg/.nvm/versions/node/v9.11.1/lib/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/josephg/.nvm/versions/node/v9.11.1/bin/node" "/Users/josephg/.nvm/versions/node/v9.11.1/bin/node-gyp" "rebuild" "--target=10.0.0" "--target_arch=x64" "--release"
gyp ERR! cwd /Users/josephg/3rdparty/turbo-net
gyp ERR! node -v v9.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
node-gyp exited with 1
@mafintosh
Copy link
Collaborator

It's a Node.js 10 change where you can only prebuild against 10 using Node 10. Unsure if that was intentional though. Maybe @jasnell knows

@jasnell
Copy link

jasnell commented Apr 30, 2018

This is most likely related to v8's switchover to building with gn rather than gyp. I don't have all the specific details but @rvagg may be able to help point in the right direction.

@rvagg
Copy link

rvagg commented May 5, 2018

build_v8_with_gn was introduced in the 6.6 update, it's something that the v8 team uses to build Node so they can avoid gyp entirely. ./configure --build-v8-with-gn as per https://docs.google.com/document/d/1gvHuesiuvLzD6X6ONddxXRxhODlOJlxgfoTNZTlKLGA/edit#heading=h.du51pfc2s9e9

It's set to "false" by default in ./configure, so every Node 10 config.gypi has 'build_v8_with_gn': 'false' (node -p process.config.variables.build_v8_with_gn). So the idea is that Node 10's ./configure produces the right kind of config.gypi but the above output looks like it might be using a config.gypi from a different version of Node? It has /Users/josephg/3rdparty/turbo-net/build/config.gypi in it. Where might this file be coming from @mafintosh? Is it generated by node-gyp-bin? I see Node 9.11.1 in the output, would something in this build chain be reaching into the 9.11.1 sources/headers to grab config.gypi and be trying to apply it to a Node 10 build?

I think maybe we could/should be putting a 'build_v8_with_gn%': false in config.gypi as a default and this problem might go away, but I'd need to test, so I'm probably going to have to figure out how to reproduce this. Can someone here give me a quick example to reproduce this with an addon without having to fully grok the toolchain here?

@josephg
Copy link
Author

josephg commented May 27, 2018

Thanks - I reliably reproduce it with literally any prebuildify run using node 9.11.1 and building against 10+. Ie, prebuildify -t 10.0.0.

sephsmac:node-fdb josephg$ node --version
v9.11.1
sephsmac:node-fdb josephg$ prebuildify -t 10.0.0
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@9.11.1 | darwin | x64
...
gyp: name 'build_v8_with_gn' is not defined while evaluating condition 'build_v8_with_gn == "true"' in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1

@mafintosh
Copy link
Collaborator

@rvagg to reproduce try using node-gyp on node < 10 and build a project for node 10.

@vweevers
Copy link
Member

If someone wants to tackle this: copy prebuild/prebuild#223 to prebuildify.

@gonzus
Copy link

gonzus commented May 26, 2020

Just as an FYI, I was seeing this problem today when running prebuildify --napi and it went away when I switched to prebuildify --napi -t 10.19.0 (which is the version of node I am using):

gyp info using node-gyp@6.1.0
gyp info using node@10.19.0 | linux | x64
gyp info find Python using Python version 3.8.2 found at "/usr/bin/python3"

@antholord
Copy link

Thank you @gonzus , that fixed it for me as well.

@aminya
Copy link
Contributor

aminya commented Oct 20, 2020

I also have this problem on Node 12 or Node 10
atom-community/zadeh#15 (comment)

Is there any solution? Node 12 is the version that we actually use.

@vweevers @reconbot

@aminya
Copy link
Contributor

aminya commented Oct 20, 2020

I found the reason for this issue. When we use napi it uses the latest Node (14.0.0), so it works only on Node 14.

See the pop here!

abi.supportedTargets.filter(onlyElectron).pop()

@vweevers
Copy link
Member

Fixed in #48, 4.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

8 participants