nginx: /lib64/libcrypt.so.1: version `XCRYPT_2.0' not found

1.报错信息

[root@ba6649b3a783 sbin]# ./nginx --t
./nginx: /lib64/libcrypt.so.1: version `XCRYPT_2.0' not found (required by ./nginx)
./nginx: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by ./nginx)
./nginx: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by ./nginx)
./nginx: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by ./nginx)

2.报错原因说明

  • 这些错误表明 Nginx 可执行文件链接到了一个或多个系统库,而这些库的版本与当前系统不兼容。主要的问题在于缺少所需的 GLIBC 版本。
  • 解决此问题的方法之一是在构建 Nginx 时静态链接所需的库,以便 Nginx 可以独立于系统中的库版本运行。这样做可以确保 Nginx 在不同的系统上都能正常工作,而不受系统库版本的影响。
  • 我们可以使用 configure 脚本的 --with-ld-opt 参数,将 -static 添加到链接选项中,以静态链接所需的库。

3.解决方法

./configure --prefix=/data/service/nginx \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-http_mp4_module \
--with-stream \
--with-http_realip_module \
--with-http_v2_module \
--with-http_sub_module \
--with-ld-opt='-static'      #增加一条配置

4.其他正常编译

posted @ 2024-05-16 16:03  Leonardo-li  阅读(1055)  评论(0编辑  收藏  举报