node-gyp
node-gyp copied to clipboard
’libraries‘ config not used when compile source files
- Node Version: npm(6.14.13) node(v14.17.6)
- Platform: macOS Big Sur 11.6.1
- Compiler: Apple clang version 13.0.0 (clang-1300.0.29.3)
I set this in binding.gpy
"libraries": [
'-F/Users/plum/Desktop/addon/lib/ -framework Plum2',
],
but it not used when compile source file.
this is complile log
node-gyp rebuild --debug -v
c++ '-DNODE_GYP_MODULE_NAME=hello' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' '-DDEBUG' '-D_DEBUG' '-DV8_ENABLE_CHECKS' -I/Users/plum/Library/Caches/node-gyp/14.17.6/include/node -I/Users/plum/Library/Caches/node-gyp/14.17.6/src -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/config -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/openssl/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/uv/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/zlib -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/v8/include -I../node_modules/node-addon-api -I/Users/plum/Desktop/addon/lib/Plum2.framework -O0 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Debug/.deps/Debug/obj.target/hello/src/hello.o.d.raw -c -o Debug/obj.target/hello/src/hello.o ../src/hello.cc
i want -F/Users/plum/Desktop/addon/lib/ -framework Plum2
will be used when compile source files
node-gyp -v
and please provide the full error log.
➜ addon npm run gyp:debug
[email protected] gyp:debug /Users/plum/Desktop/addon node-gyp rebuild --debug --v
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/usr/local/bin/node',
gyp verb cli '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--debug',
gyp verb cli '--v'
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp verb find Python - executing "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" to get version
gyp verb find Python - version is "2.7.16"
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp verb get node dir no --target version specified, falling back to host node version: 14.17.6
gyp verb command install [ '14.17.6' ]
gyp verb install input version string "14.17.6"
gyp verb install installing version: 14.17.6
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 14.17.6
gyp verb build dir attempting to create "build" dir: /Users/plum/Desktop/addon/build
gyp verb build dir "build" dir needed to be created? /Users/plum/Desktop/addon/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/plum/Desktop/addon/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/plum/Desktop/addon/config.gypi
gyp verb common.gypi checking for gypi file: /Users/plum/Desktop/addon/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/npm/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/plum/Desktop/addon/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/plum/Library/Caches/node-gyp/14.17.6/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/plum/Library/Caches/node-gyp/14.17.6',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/plum/Library/Caches/node-gyp/14.17.6/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/plum/Desktop/addon',
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 info spawn args ]
gyp verb command build []
gyp verb build type Debug
gyp verb architecture x64
gyp verb node dev dir /Users/plum/Library/Caches/node-gyp/14.17.6
gyp verb which
succeeded for make
/usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Debug', '-C', 'build' ]
c++ '-DNODE_GYP_MODULE_NAME=hello' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' '-DDEBUG' '-D_DEBUG' '-DV8_ENABLE_CHECKS' -I/Users/plum/Library/Caches/node-gyp/14.17.6/include/node -I/Users/plum/Library/Caches/node-gyp/14.17.6/src -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/config -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/openssl/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/uv/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/zlib -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/v8/include -I../node_modules/node-addon-api -I/Users/plum/Desktop/addon/lib/Plum2.framework -O0 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Debug/.deps/Debug/obj.target/hello/src/hello.o.d.raw -c -o Debug/obj.target/hello/src/hello.o ../src/hello.cc
../src/hello.cc:2:10: fatal error: 'Plum2/Plum2.h' file not found
#include <Plum2/Plum2.h>
^~~~~~~~~~~~~~~
1 error generated.
make: *** [Debug/obj.target/hello/src/hello.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--debug" "--v"
gyp ERR! cwd /Users/plum/Desktop/addon
gyp ERR! node -v v14.17.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] gyp:debug: node-gyp rebuild --debug --v
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] gyp:debug script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/plum/.npm/_logs/2021-10-28T09_45_57_916Z-debug.log
gyp ERR! node-gyp -v v5.1.0
v.s. https://github.com/nodejs/node-gyp/releases
Please upgrade using https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md
gyp verb find Python - version is "2.7.16"
Python 2 died 666 days ago on 1/1/2020 so it is no longer supported by node-gyp.
@cclauss Thank you for your reply but upgrading node-gyp did not solve this issue.
addon node-gyp rebuild --debug -v gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli '/usr/local/bin/node', gyp verb cli '/usr/local/bin/node-gyp', gyp verb cli 'rebuild', gyp verb cli '--debug', gyp verb cli '-v' gyp verb cli ] gyp info using [email protected] gyp info using [email protected] | darwin | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb find Python Python is not set from command line or npm configuration gyp verb find Python Python is not set from environment variable PYTHON gyp verb find Python checking if "python3" can be used gyp verb find Python - executing "python3" to get executable path gyp verb find Python - executable path is "/usr/local/opt/[email protected]/bin/python3.9" gyp verb find Python - executing "/usr/local/opt/[email protected]/bin/python3.9" to get version gyp verb find Python - version is "3.9.6" gyp info find Python using Python version 3.9.6 found at "/usr/local/opt/[email protected]/bin/python3.9" gyp verb get node dir no --target version specified, falling back to host node version: 14.17.6 gyp verb command install [ '14.17.6' ] gyp verb install input version string "14.17.6" gyp verb install installing version: 14.17.6 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version is already installed, need to check "installVersion" gyp verb got "installVersion" 9 gyp verb needs "installVersion" 9 gyp verb install version is good gyp verb get node dir target node version installed: 14.17.6 gyp verb build dir attempting to create "build" dir: /Users/plum/Desktop/addon/build gyp verb build dir "build" dir needed to be created? Yes gyp verb build/config.gypi creating config file gyp verb build/config.gypi writing out config file: /Users/plum/Desktop/addon/build/config.gypi gyp verb config.gypi checking for gypi file: /Users/plum/Desktop/addon/config.gypi gyp verb common.gypi checking for gypi file: /Users/plum/Desktop/addon/common.gypi gyp verb gyp gyp format was not specified; forcing "make" gyp info spawn /usr/local/opt/[email protected]/bin/python3.9 gyp info spawn args [ gyp info spawn args '/usr/local/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/plum/Desktop/addon/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/plum/Library/Caches/node-gyp/14.17.6/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/plum/Library/Caches/node-gyp/14.17.6', gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/plum/Library/Caches/node-gyp/14.17.6/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/plum/Desktop/addon', 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 info spawn args ] gyp verb command build [] gyp verb build type Debug gyp verb architecture x64 gyp verb node dev dir /Users/plum/Library/Caches/node-gyp/14.17.6 gyp verb
which
succeeded formake
/usr/bin/make gyp info spawn make gyp info spawn args [ 'V=1', 'BUILDTYPE=Debug', '-C', 'build' ] c++ -o Debug/obj.target/hello/src/hello.o ../src/hello.cc '-DNODE_GYP_MODULE_NAME=hello' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' '-DDEBUG' '-D_DEBUG' '-DV8_ENABLE_CHECKS' -I/Users/plum/Library/Caches/node-gyp/14.17.6/include/node -I/Users/plum/Library/Caches/node-gyp/14.17.6/src -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/config -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/openssl/openssl/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/uv/include -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/zlib -I/Users/plum/Library/Caches/node-gyp/14.17.6/deps/v8/include -I../node_modules/node-addon-api -I/Users/plum/Desktop/addon/lib/Plum2.framework -O0 -gdwarf-2 -mmacosx-version-min=10.13 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Debug/.deps/Debug/obj.target/hello/src/hello.o.d.raw -c ../src/hello.cc:2:10: fatal error: 'Plum2/Plum2.h' file not found #include <Plum2/Plum2.h> ^~~~~~~~~~~~~~~ 1 error generated. make: *** [Debug/obj.target/hello/src/hello.o] Error 1 gyp ERR! build error gyp ERR! stack Error:make
failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:400:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild" "--debug" "-v" gyp ERR! cwd /Users/plum/Desktop/addon gyp ERR! node -v v14.17.6 gyp ERR! node-gyp -v v8.3.0 gyp ERR! not ok ➜ addon
this is my demo addon.zip