-
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
fix: resolve issue with relative paths during linking #3128
Open
Dw9
wants to merge
2
commits into
nodejs:main
Choose a base branch
from
Dw9:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My binding.gyp configuration {
"targets": [
{
"target_name": "addon",
"cflags!": [ "-fno-exceptions -fPIC -fWunused-variable -fWint-to-pointer-cast]" ],
"cflags_cc!": [ "-fno-exceptions -fPIC -fWunused-variable -fWint-to-pointer-cast]" ],
"sources": [ "addon.cc", "myobject.cc" ],
"include_dirs": [
"../3rdpart/include",
"<!@(node -p \"require('node-addon-api').include\")"
],
"library_dirs" : [
"../3rdpart/lib"
],
"libraries": [
"-ltest"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}
]
} |
Compilation log node-addon-api node-gyp build --verbose
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli '/home/zhibo/.nvm/versions/node/v22.13.0/bin/node',
gyp verb cli '/home/zhibo/.nvm/versions/node/v22.13.0/bin/node-gyp',
gyp verb cli 'build',
gyp verb cli '--verbose'
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/zhibo/.cache/node-gyp/22.13.0
gyp verb python /home/zhibo/miniconda3/bin/python3
gyp verb `which` succeeded for `make` /usr/bin/make
gyp verb bin symlinks created symlink to "/home/zhibo/miniconda3/bin/python3" in "/home/zhibo/6_object_wrap/node-test/node-addon-api/build/node_gyp_bins" and added to PATH
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/zhibo/6_object_wrap/node-test/node-addon-api/build'
g++ -o Release/obj.target/addon/addon.o ../addon.cc '-DNODE_GYP_MODULE_NAME=addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' -I/home/zhibo/.cache/node-gyp/22.13.0/include/node -I/home/zhibo/.cache/node-gyp/22.13.0/src -I/home/zhibo/.cache/node-gyp/22.13.0/deps/openssl/config -I/home/zhibo/.cache/node-gyp/22.13.0/deps/openssl/openssl/include -I/home/zhibo/.cache/node-gyp/22.13.0/deps/uv/include -I/home/zhibo/.cache/node-gyp/22.13.0/deps/zlib -I/home/zhibo/.cache/node-gyp/22.13.0/deps/v8/include -I../../3rdpart/include -I/home/zhibo/6_object_wrap/node-test/node-addon-api/node_modules/.pnpm/[email protected]/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/addon/addon.o.d.raw -c
g++ -o Release/obj.target/addon/myobject.o ../myobject.cc '-DNODE_GYP_MODULE_NAME=addon' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DBUILDING_NODE_EXTENSION' -I/home/zhibo/.cache/node-gyp/22.13.0/include/node -I/home/zhibo/.cache/node-gyp/22.13.0/src -I/home/zhibo/.cache/node-gyp/22.13.0/deps/openssl/config -I/home/zhibo/.cache/node-gyp/22.13.0/deps/openssl/openssl/include -I/home/zhibo/.cache/node-gyp/22.13.0/deps/uv/include -I/home/zhibo/.cache/node-gyp/22.13.0/deps/zlib -I/home/zhibo/.cache/node-gyp/22.13.0/deps/v8/include -I../../3rdpart/include -I/home/zhibo/6_object_wrap/node-test/node-addon-api/node_modules/.pnpm/[email protected]/node_modules/node-addon-api -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -fno-strict-aliasing -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/addon/myobject.o.d.raw -c
g++ -o Release/obj.target/addon.node -shared -pthread -rdynamic -m64 -L../3rdpart/lib -Wl,-soname=addon.node -Wl,--start-group Release/obj.target/addon/addon.o Release/obj.target/addon/myobject.o -Wl,--end-group -ltest
/usr/bin/ld: cannot find -ltest: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [addon.target.mk:146: Release/obj.target/addon.node] Error 1
make: Leaving directory '/home/zhibo/6_object_wrap/node-test/node-addon-api/build' |
cclauss
reviewed
Feb 13, 2025
Co-authored-by: Christian Clauss <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
npm install && npm run lint && npm test
passesDescription of change
hi~ I encountered an issue with library resolution when configuring binding.gyp. Below are the details of my configuration and the compilation process.
node-gyp correctly handled the header file directory, but the library directory wasn't processed during the linking phase. I am new to Node.js, and I would appreciate any feedback or corrections if something is wrong.