【发布时间】:2017-02-28 23:41:18
【问题描述】:
我正在尝试使用 node-gyp 构建 node.js C++,但不知道如何指定 -Wl,-rpath,$ORIGIN,以便从节点加载时它可以找到与相同目录中的共享对象库addon.node.
我已经尝试像这样设置我的binding.gyp:
"libraries": [
"-L../../install_release_x64/",
"-llibppp"
],
"ldflags": [
"-Wl,-rpath,'$ORIGIN'"
],
"cflags_cc": [
"-fexceptions",
"-fPIC",
"-Wno-unknown-pragmas"
]
但是当我运行$ readelf -d addon.node 时,结果是这样的:
Dynamic section at offset 0x7d10 contains 29 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [liblibppp.so]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname: [addon.node]
0x000000000000000f (RPATH) Library rpath: [RIGIN]
0x000000000000000c (INIT) 0x37a0
预期结果是Library rpath: [$ORIGIN]
知道 node-gyp 对我的 $ORIGIN 特殊关键字做了什么吗?
【问题讨论】:
标签: node.js gcc node-modules node-gyp compiler-flags