简体   繁体   中英

How to compile node.js for CentOS 6.10 (library issues)

I'm trying to get the newest version of node (12.1.0, at present) running on a CentOS 6.10 box. This is a problem because the standard CentOS binaries are out of date; eg:

./node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./node)
(a number of other references like this also appear)

when I try to install and run the binaries, and the g++ / c++ tools are out of date. But I've decided to try to compile from source, if I can get the tools properly aligned.

I've gotten an updated version of the compiler tools from the CERN devtools ( http://linux.web.cern.ch/linux/devtoolset ), and seemingly have them installed properly. What I've gotten from various places around the web is that I need to export pointers to these new libraries before doing the configure, like:

export CC=/opt/rh/devtoolset-2/root/usr/bin/gcc  
export CPP=/opt/rh/devtoolset-2/root/usr/bin/cpp
export CXX=/opt/rh/devtoolset-2/root/usr/bin/c++

These do have the updated and sufficiently modern versions, eg,

/opt/rh/devtoolset-2/root/usr/bin/c++ --version
c++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)

But they don't seem to be getting into the configuration process:

[root@linux2 node-v12.1.0]# ./configure --prefix=/opt/node-12.1.0
WARNING: C++ compiler too old, need g++ 6.3.0 or clang++ 8.0.0 (CXX=/opt/rh/devtoolset-2/root/usr/bin/c++)
INFO: Using floating patch "tools/icu/patches/64/source/common/putil.cpp" from "tools/icu"
INFO: Using floating patch "tools/icu/patches/64/source/i18n/dtptngen.cpp" from "tools/icu"
WARNING: warnings were emitted in the configure phase
INFO: configure completed successfully

When I cross my fingers and try to make anyway, I get a whole bunch of compilation results and then a bunch of errors, omitted here (for now) for brevity.

Anyway: it's just not working. Can anyone see what's going on here, and how I can get things right? Thanks!

You need a newer devtoolset, 6 or 7 instead of 2. This link should help. And use scl like it suggests instead of setting env vars yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM