How to build nodejs C++ addon depending on a shared library with relative location
I'm trying to build a node.js C++ using node-gyp but can't figure out how to specify the -Wl,-rpath,$ORIGIN so that when loaded from node it could find shared object library that is in the same directory as addon.node . I have tried setting my binding.gyp like this: "libraries": [ "-L../../install_release_x64/", "-llibppp" ], "ldflags": [ "-Wl,-rpath,'$ORIGIN'" ], "cflags_cc": [ "-fexceptions", "-fPIC", "-Wno-unknown-pragmas" ] but when I run $ readelf -d addon.node the result is like this: Dynamic section at offset 0x7d10 contains 29 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED)