Skip to content
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

继续在 centos7 中使用 nodejs18 #64

Open
luckyyyyy opened this issue Jun 3, 2022 · 2 comments
Open

继续在 centos7 中使用 nodejs18 #64

luckyyyyy opened this issue Jun 3, 2022 · 2 comments

Comments

@luckyyyyy
Copy link
Owner

luckyyyyy commented Jun 3, 2022

由于官方升级了全套工具链,导致 nodejs18 不能在 centos7 中使用。
但根据实际测试来看,完全可以继续使用,v8中也没有使用glibc2.17以上的功能,主要之前有一次提交使用了高版本ABI,但后续也做了兼容v8/v8@4e81f25

# root @ centos7-build in ~/node-v18.3.0-linux-x64/bin [9:20:05] 
$ ./node
./node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by ./node)
./node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./node)

当然 centos7 的支持生命周期也即将结束,不过因为国内的特殊原因,太多老系统还在继续使用 centos7

nodejs18 有太多诱人的功能,包括更新了v8到10.x 更新了openssl3.x(小心native插件的动态库符号冲突)
还有用户快照的支持,即将有js API,之后就可以把库都编译进快照,大大提升启动速度,比pkg等打包工具会好非常多

我们可以自己编译nodejs18

yum makecache
yum install centos-release-scl
yum install devtoolset-11 # 选择新一些的工具链 测试了完全没问题
yum install ninja-build # 安装ninja 会让编译快很多 nodejs支持使用ninja编译
scl enable devtoolset-11 bash # or zsh 

# 可以 clone nodejs 源码了
git clone https://github.com/nodejs/node.git
cd node
# 切换到对应的分支 建议看一下 commit 切换到对应的 commit 上 否则会有 pre 标记
git checkout v18.x

./configure --ninja # 推荐使用 ninja 编译
make
out/Release/node -v
out/Release/cctest

也可以关注下这个issue是否被采纳nodejs/node#43246

@luckyyyyy
Copy link
Owner Author

我的项目中,使用到了大量的native插件和nodejs超过90%的API,运行一切正常

image

image

@YSHIDM
Copy link

YSHIDM commented Apr 3, 2023

谢谢,万叶

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants