nodejs / nodejs/node-gyp

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

Open
#2,641 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Linux
Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

  • 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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing node-gyp's native addon linking configuration alongside the reported --nostdlib and local-library rpath attempts. Determine whether an addon can avoid runtime dependencies on libc and libstdc++, and document the supported limitations or configuration if one exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.