Tag: 编译器标志

如何根据具有相对位置的共享库构buildnodejs C ++插件

我正在尝试使用node-gyp构buildnode.js C ++,但无法弄清楚如何指定-Wl,-rpath,$ORIGIN以便在从节点加载时可以find相同的共享对象库目录作为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] […]