My nodejs
addon uses cares
library and my binding.gyp
has dependencies
attribute which is pointing to this. Now whenever I have to run addon
, I have to export LD_LIBRARY_PATH
variable.
Is there a way I can configure this in binding.gyp
so that every time I don't have to set LD_LIBRARY_PATH
. (Linking at build time)
Dependency setting in binding.gyp: "dependencies": [ "deps/cares/cares.gyp:cares" ]
Ex export: export LD_LIBRARY_PATH=build/Release
"libraries": [ "-Wl,-rpath,./build/Release/" ]
Worked for me on Mac as well as Linux(Ubuntu).
My answer to how to add dependence to static library in binding.gyp node-gyp for node.js extension seems to apply here as well, and should be cross platform.
In short it uses the module_root_dir
and builds an absolute path.
Example:
"libraries": [
"-lcares",
"-L<(module_root_dir)/build/Release/"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With