【问题标题】:How to compile node.js for CentOS 6.10 (library issues)如何为 CentOS 6.10 编译 node.js(库问题)
【发布时间】:2019-09-19 15:37:39
【问题描述】:

我正在尝试在 CentOS 6.10 机器上运行最新版本的节点(目前为 12.1.0)。这是一个问题,因为标准的 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 开发工具 (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 时,我得到一大堆编译结果,然后是一堆错误,为了简洁起见,这里(暂时)省略了。

无论如何:它只是不工作。谁能看到这里发生了什么,以及我怎样才能把事情做好?谢谢!

【问题讨论】:

  • need g++ 6.3.0 or clang++ 8.0.0 而你正在使用4.8.2
  • 谢谢,包括@jamieguinan -- 花了一些时间,但我终于安装了 devtoolset7(在解决了 sci-utils 的一些依赖问题之后),并且启动并运行了 node-12.1。 0。 (devtoolset-2 中的 c++ 足以编译节点 12,但它在“make install”时中断。)谢谢! (顺便说一句,如果你把你的评论变成答案,我会给你一个答案。)

标签: c++ node.js linux centos


【解决方案1】:

您需要更新的开发工具集,6 或 7 而不是 2。This link 应该会有所帮助。并像它建议的那样使用scl,而不是自己设置环境变量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-25
    • 1970-01-01
    • 2019-07-21
    • 1970-01-01
    • 2011-08-31
    • 2023-03-09
    • 2022-06-14
    • 1970-01-01
    相关资源
    最近更新 更多