node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

is it possible to statically link libc/libstdc++ with a node-addon?

Open bmacnaughton opened this issue 3 years ago • 1 comments

  • Node Version: v16.14.2, v8.5.0
  • Platform: ubuntu 20.04 (wsl)
  • Compiler: gcc 9.3.0
  • Module: @contrast/heapdump

This is really a question; my goal is to create a node-addon that can be loaded but does not require the system versions of libc or libstdc++ (or any other various dependencies). The reason for this goal is to create an addon that will not break if an older system does not support the GLIBC, CXXABI, or GLIBCXX versions required by the build.

I'm not an expert in this, but have tried setting the cflag --nostdlib, putting copies of the system libraries in a local directory, and setting rpath to find the files locally. i've been able to use that for my own shared libraries, but haven't gotten it to work with system libraries. I think the reasons is that even local copies of .so files have dependencies to system libraries.

Is there a way to build a node-addon that has no dependencies on system libraries at load/run-time?

bmacnaughton avatar Apr 06 '22 20:04 bmacnaughton

libstdc++ statically link is ok. But libc can't. same problem with you ...

zhourubin avatar Nov 02 '22 02:11 zhourubin