Roy*_*nto 12 c++ node.js node-gyp
我的nodejs
插件使用cares
库和我的binding.gyp
has dependencies
属性指向这个.现在每当我必须运行时addon
,我必须导出LD_LIBRARY_PATH
变量.
有没有办法我可以配置它,binding.gyp
以便每次我不必设置LD_LIBRARY_PATH
.(在构建时链接)
binding.gyp中的依赖关系设置: "dependencies": [ "deps/cares/cares.gyp:cares" ]
出口出口: export LD_LIBRARY_PATH=build/Release
"libraries": [ "-Wl,-rpath,./build/Release/" ]
在Mac和Linux(Ubuntu)上为我工作.
我对如何在 binding.gyp node-gyp for node.js 扩展中添加对静态库的依赖的答案似乎也适用于此,并且应该是跨平台的。
简而言之,它使用module_root_dir
并构建绝对路径。例子:
"libraries": [
"-lcares",
"-L<(module_root_dir)/build/Release/"
]
Run Code Online (Sandbox Code Playgroud)