我正在尝试让最新版本的 Node (目前为 12.1.0)在 CentOS 6.10 机器上运行。这是一个问题,因为标准的 CentOS 二进制文件已经过时了;例如:
./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)
当我尝试安装和运行二进制文件时,g++/c++ 工具已过时。但我决定尝试从源代码编译,如果我能正确对齐工具的话。
我已经从 CERN devtools ( http://linux.web.cern.ch/linux/devtoolset ) 获得了编译器工具的更新版本,并且似乎已经正确安装了它们。我从网上的各个地方得到的是,我需要在进行配置之前导出指向这些新库的指针,例如:
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++
这些确实有更新的和足够现代的版本,例如,
/opt/rh/devtoolset-2/root/usr/bin/c++ --version
c++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
但他们似乎并没有进入配置过程:
[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
当我祈祷并尝试 make
时,我得到了一大堆编译结果,然后是一堆错误,为简洁起见,此处(暂时)省略了这些错误。
无论如何:它就是不起作用。任何人都可以看到这里发生了什么,以及我如何才能把事情做好?谢谢!
最佳答案
您需要更新的开发工具集,6 或 7 而不是 2。This link应该有帮助。并像它建议的那样使用 scl
而不是自己设置环境变量。
关于c++ - 如何为 CentOS 6.10 编译 node.js(库问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55930010/