-
Notifications
You must be signed in to change notification settings - Fork 76
Fix Loong64 GLIBCXX version errors by statically linking libstdc++ #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Yeah, I don't know about this, it's one of the reasons I try and discourage the use of the most recent distros to build on, so we don't get tangled in too-modern libc and libstdc++. This
ubuntu-toolchain-r/test installed on them as well.I'd prefer someone put in some effort to try and downgrade the container and not have to rely on ubuntu-toolchain-r. I don't know if some form of centos is available for loong64 but that would be ideal because the devtoolsets are much better at maintaining maximal compatibility than what you can do on Ubuntu where your best choice is to pick the denominator that supports the compiler you need.
|
|
@rvagg ,Thanks for your insights . However, for the LoongArch architecture, We’ve found ourselves needing to rely on relatively new toolchains and Ubuntu 24.04, mainly due to the following constraints.: First, LoongArch is a relatively new instruction set, and its support requires newer versions of toolchains: Binutils only started supporting LSX and LASX from version 2.41 (https://github.com/loongson/build-tools/wiki#binutils-related-support). The static linking approach in this PR (adding LDFLAGS="-static-libstdc++") was specifically chosen to address the GLIBCXX version issues while working within these toolchain constraints. |
|
gcc-12 and later supports the LoongArch architecture. However, using gcc-12 may cause some issues when compiling node v24.x. gcc-13 does not fully support LSX (Loongson SIMD Extension) and LASX (Loongson Advanced SIMD Extension), which can affect the performance of simdutf, simdjson, and other libraries. gcc-14 fully supports LSX and LASX. |
|
|
OK, I have 3 of you in here, if you can all agree on the path forward here then I'll go with that. It looks like @wojiushixiaobai is suggesting to use a configure flag to achieve this instead. |
|
I think using --partly-static is a good approach as it maintains compatibility. Using --fully-static would statically link glibc. I prefer dynamically linking glibc, which allows for timely use of CVE fixes in the system's glibc. |
…ly-static Add --partly-static to config_flags in compilation script to enable partial static linking of libstdc++ during Node.js build. This addresses the runtime error where the Loong64 Node.js binary fails to find required GLIBCXX versions in system libstdc++.so.6.
|
Thank you all for the feedback! I've updated my commit to only modify the configure file with the --partly-static parameter as suggested. |
|
OK, docker rebuild was successful, I've queued up a 24.7.0 rebuild for you, watch for new files in https://unofficial-builds.nodejs.org/download/release/v24.7.0/, also watch for a new log directory for 24.7.0 at the bottom of https://unofficial-builds.nodejs.org/logs/ where you can see the build for it if there's any problems. |
Description:
This PR addresses the GLIBCXX version compatibility issues reported in:
#187
#176 (comment)
The cross-compiled Node.js binaries for Loong64 were failing at runtime with errors like:
Solution:
Added export LDFLAGS="-static-libstdc++" to recipes/loong64/run.sh to statically link the libstdc++ library during compilation.
This fixes the runtime error where the cross-compiled Node.js binary for Loong64 fails to find required GLIBCXX versions.