unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Abhishek Cherath <abhi@quic.us>
To: 59393@debbugs.gnu.org
Subject: bug#59393: [node] node-gyp dependent packages may not work correctly due to node-lts ld.so.cache
Date: Sat, 19 Nov 2022 19:06:24 -0500	[thread overview]
Message-ID: <381e762e-5a44-a746-b3c9-1a680d7ec260@quic.us> (raw)

Hello,

This is a fairly involved bug report, the basic idea is that several npm 
packages depend on [node-gyp](https://www.npmjs.com/package/node-gyp), 
which is a build tool (written in python) that compiles native plugins 
for nodejs (so generally C/C++ code).

This tool uses the *system* C/C++ compiler, so on a guix system with 
gcc-toolchain, that would be gcc-12. this allows for the compilation and 
installation of these packages in node_modules fine. However, at runtime 
(which happens as `node program.js`) since the dynamic linker looks in 
the node-lts package's ld.so.cache, it tries to link against gcc-10's 
libstdc++.so.6, and errors out because of missing symbols.

To Reproduce, attempt the following (this isn't a particularly minimal 
example)
1.  guix shell --pure gcc-toolchain libuv mesa make python2 pkg-config 
libx11 libxext libxi node
2. cd <<SOME-DIR>>
3. CC=gcc npm i gl
4.  guix shell gcc-toolchain libuv mesa make python2 pkg-config libx11 
libxext libxi node
5. echo "var gl = require('gl')(64, 64, { preserveDrawingBuffer: true 
})" > test.js
6. node test.js

observe "ERR_DLOPEN_FAILED", with Error: 
/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/libstdc++.so.6: 
version `GLIBCXX_3.4.29' not found

running with LD_DEBUG=all, shows that node-14.19.3's linked gcc's 
libstdc++ is used:

3608:     find library=libstdc++.so.6 [0]; searching
3608:      search 
cache=/gnu/store/mgxvqphymkf1xfz4zryppr1jwnd5xcyw-node-14.19.3/etc/ld.so.cache
3608:       trying 
file=/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/libstdc++.so.6


I'm not really certain how one would go about solving this tbh, I'm 
planning to look a little deeper into how node-gyp decides what C++ 
compiler to use, might be a matter of setting some env vars or 
something? any ideas are appreciated.

Thank you,
Abhishek.




                 reply	other threads:[~2022-11-20  0:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=381e762e-5a44-a746-b3c9-1a680d7ec260@quic.us \
    --to=abhi@quic.us \
    --cc=59393@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).