bin/ld: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information.
· 技术积累 · Linux PHP

php编译过程中最后报错,出现此错误:
make: *** [Makefile:306: sapi/fpm/php-fpm] Error 1
这个是先出现的错误: bin/ld: Dwarf Error: found dwarf version '5', this reader only handles version 2, 3 and 4 information.

经查阅资料问题是因为gcc版本太高导致

# 当前centos7系统
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC) 

解决: 降级gcc版本

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

# 临时启用
scl enable devtoolset-9 bash

# 永久启动
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

# 查看gcc版本
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-9/root/usr --mandir=/opt/rh/devtoolset-9/root/usr/share/man --infodir=/opt/rh/devtoolset-9/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-9.3.1-20200408/obj-x86_64-redhat-linux/isl-install --disable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC) 

再次编译通过没问题了


本文最后更新时间 2023-03-29
文章链接地址:
https://hope.jinchuang.org/archives/1328.html
本站文章除注明[转载|引用],均为本站原创内容,转载前请注明出处
关于网站搬家后,评论邮件通知发送失败报错的问题(openssl的问题)
typecho博客根据时间自动切换主题配色
Ubuntu 22.04 源码编译安装 PHP7.4 使用OpenSSL1.1.1版本
统计文本中每个字符出现的次数

MAXMIND 免费的GeoLite2数据库分享

ChatGPT 接入微信聊天

我要留言