设为首页收藏本站

ZMX - IT技术交流论坛 - 无限Perfect,追求梦想 - itzmx.com

 找回密码
 注册论坛

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

用百度帐号登录

只需两步,快速登录

搜索
查看: 30|回复: 0

Linux centos php8.1编译报错libxml,更新gcc v9.5.0版本,对应vs2019 c++20 和binutils的as汇编器v2.38

[复制链接]
 成长值: 345

签到天数: 4740 天

[LV.Master]伴坛终老

发表于 2024/12/26 02:43 | 显示全部楼层 |阅读模式 |Google Chrome 131.0.0.0|Windows 10
天涯海角搜一下: 百度 谷歌 360 搜狗 有道 雅虎 必应 即刻
Linux centos php8.1编译报错libxml,更新gcc v9.5.0版本,对应vs2019 c++20 和binutils的as汇编器v2.38

/bin/sh /root/php-8.1.31/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -std=gnu99 -Iext/libxml/ -I/root/php-8.1.31/ext/libxml/ -I/root/php-8.1.31/include -I/root/php-8.1.31/main -I/root/php-8.1.31 -I/root/php-8.1.31/ext/date/lib -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/include/libpng12 -I/root/php-8.1.31/ext/mbstring/libmbfl -I/root/php-8.1.31/ext/mbstring/libmbfl/mbfl -I/root/php-8.1.31/TSRM -I/root/php-8.1.31/Zend    -fno-common -Wstrict-prototypes -Wlogical-op -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -g -O2 -fvisibility=hidden -DZEND_SIGNALS   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /root/php-8.1.31/ext/libxml/libxml.c -o ext/libxml/libxml.lo  -MMD -MF ext/libxml/libxml.dep -MT ext/libxml/libxml.lo
In file included from /root/php-8.1.31/ext/libxml/libxml.c:43:
/root/php-8.1.31/ext/libxml/php_libxml.h: 在函数‘php_libxml_sanitize_parse_ctxt_options’中:
/root/php-8.1.31/ext/libxml/php_libxml.h:170: 错误:#pragma GCC diagnostic 不允许用在函数体中
/root/php-8.1.31/ext/libxml/php_libxml.h:170: 错误:#pragma GCC diagnostic 不允许用在函数体中
/root/php-8.1.31/ext/libxml/php_libxml.h:178: 错误:#pragma GCC diagnostic 不允许用在函数体中
make: *** [ext/libxml/libxml.lo] 错误 1


好像是php自身的问题,联系官方后得知是gcc版本的问题,gcc需要依赖GMP、MPFR、MPC,由于gcc v10.1.0版本开始要求高版本MPFR,为了直接yum方便开发库,所以就用v9.5.0啦
编译最少需要2G内存,经过优化的编译参数,不过由于支持多个高版本c++,所以还是很花时间,4核心cpu花费29分钟左右完成
  1. yum -y install wget bzip2 make automake gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel
  2. wget https://mirrors.aliyun.com/gnu/gcc/gcc-9.5.0/gcc-9.5.0.tar.gz
  3. tar zxf gcc-9.5.0.tar.gz
  4. cd gcc-9.5.0
  5. ./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib --with-system-zlib --disable-nls
  6. make -j 4
  7. make install
  8. rm -rf /usr/bin/gcc.OFF
  9. mv /usr/bin/gcc /usr/bin/gcc.OFF
  10. ln -s /usr/local/bin/gcc /usr/bin/gcc
  11. /usr/bin/gcc --version
复制代码


检查版本
  1. gcc --version
复制代码

gcc (GCC) 9.5.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


然后报错内容发生了改变
/bin/sh /root/php-8.1.31/libtool --silent --preserve-dup-deps --tag CC --mode=install cp ext/opcache/opcache.la /root/php-8.1.31/modules
/bin/sh /root/php-8.1.31/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -Iext/standard/ -I/root/php-8.1.31/ext/standard/ -I/root/php-8.1.31/include -I/root/php-8.1.31/main -I/root/php-8.1.31 -I/root/php-8.1.31/ext/date/lib -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/include/libpng12 -I/root/php-8.1.31/ext/mbstring/libmbfl -I/root/php-8.1.31/ext/mbstring/libmbfl/mbfl -I/root/php-8.1.31/TSRM -I/root/php-8.1.31/Zend    -fno-common -Wstrict-prototypes -Wformat-truncation -Wlogical-op -Wduplicated-cond -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -g -O2 -fvisibility=hidden -Wimplicit-fallthrough=1 -DZEND_SIGNALS   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -c /root/php-8.1.31/ext/standard/base64.c -o ext/standard/base64.lo  -MMD -MF ext/standard/base64.dep -MT ext/standard/base64.lo
/tmp/ccIN3E2O.s: Assembler messages:
/tmp/ccIN3E2O.s:467: Error: no such instruction: `vinserti128 $0x1,-8(%rbx),%ymm3,%ymm1'
/tmp/ccIN3E2O.s:501: Error: no such instruction: `vpermd %ymm1,%ymm0,%ymm1'
/tmp/ccIN3E2O.s:538: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:591: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:597: Error: suffix or operands invalid for `vpmulhuw'
/tmp/ccIN3E2O.s:636: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:642: Error: suffix or operands invalid for `vpmullw'
/tmp/ccIN3E2O.s:648: Error: suffix or operands invalid for `vpor'
/tmp/ccIN3E2O.s:684: Error: suffix or operands invalid for `vpcmpgtb'
/tmp/ccIN3E2O.s:691: Error: suffix or operands invalid for `vpsubusb'
/tmp/ccIN3E2O.s:724: Error: suffix or operands invalid for `vpsubb'
/tmp/ccIN3E2O.s:731: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:753: Error: suffix or operands invalid for `vpaddb'
/tmp/ccIN3E2O.s:763: Error: no such instruction: `vextracti128 $0x1,%ymm0,40(%rax)'
/tmp/ccIN3E2O.s:823: Error: no such instruction: `vinserti128 $0x1,-12(%rbx),%ymm1,%ymm1'
/tmp/ccIN3E2O.s:831: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:864: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:870: Error: suffix or operands invalid for `vpmulhuw'
/tmp/ccIN3E2O.s:909: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:915: Error: suffix or operands invalid for `vpmullw'
/tmp/ccIN3E2O.s:921: Error: suffix or operands invalid for `vpor'
/tmp/ccIN3E2O.s:957: Error: suffix or operands invalid for `vpcmpgtb'
/tmp/ccIN3E2O.s:964: Error: suffix or operands invalid for `vpsubusb'
/tmp/ccIN3E2O.s:997: Error: suffix or operands invalid for `vpsubb'
/tmp/ccIN3E2O.s:1003: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:1025: Error: suffix or operands invalid for `vpaddb'
/tmp/ccIN3E2O.s:1035: Error: no such instruction: `vextracti128 $0x1,%ymm0,-16(%rdx)'
/tmp/ccIN3E2O.s:2054: Error: suffix or operands invalid for `vpcmpeqb'
/tmp/ccIN3E2O.s:2066: Error: suffix or operands invalid for `vpaddb'
/tmp/ccIN3E2O.s:2072: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:2106: Error: suffix or operands invalid for `vpaddb'
/tmp/ccIN3E2O.s:2115: Error: suffix or operands invalid for `vpmaddubsw'
/tmp/ccIN3E2O.s:2133: Error: suffix or operands invalid for `vpmaddwd'
/tmp/ccIN3E2O.s:2152: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:2171: Error: no such instruction: `vpermd %ymm0,%ymm6,%ymm0'
/tmp/ccIN3E2O.s:2183: Error: no such instruction: `vextracti128 $0x1,%ymm0,40(%rax,%rdx)'
/tmp/ccIN3E2O.s:2211: Error: no such instruction: `vinserti128 $0x1,16(%rbx),%ymm0,%ymm10'
/tmp/ccIN3E2O.s:2239: Error: suffix or operands invalid for `vpsrld'
/tmp/ccIN3E2O.s:2247: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:2270: Error: suffix or operands invalid for `vpand'
/tmp/ccIN3E2O.s:2276: Error: suffix or operands invalid for `vpshufb'
/tmp/ccIN3E2O.s:2285: Error: suffix or operands invalid for `vpshufb'
make: *** [ext/standard/base64.lo] 错误 1


开发者回复说是binutils版本太低,发现能升级的最高版本是v2.38
查看系统自带为binutils-2.20.51.0.2-5.48.el6_10.1.x86_64
  1. yum -y install wget bzip2 make automake gcc gcc-c++ texinfo
  2. wget https://mirrors.aliyun.com/gnu/binutils/binutils-2.38.tar.gz
  3. tar zxf binutils-2.38.tar.gz
  4. cd binutils-2.38
  5. ./configure --with-system-zlib --disable-nls
  6. make -j 4
  7. make install
  8. rm -rf /usr/bin/as.OFF
  9. mv /usr/bin/as /usr/bin/as.OFF
  10. ln -s /usr/local/bin/as /usr/bin/as
  11. /usr/bin/as --version
复制代码


检查版本
  1. as --version
复制代码

GNU 汇编器 (GNU Binutils) 2.38
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-pc-linux-gnu'.

然后在编译安装php8.1就成功了,没想到变化这么大官方网站居然没列举出来
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册论坛 新浪微博账号登陆用百度帐号登录

本版积分规则

手机版|Archiver|Mail me|网站地图|IT技术交流论坛 ( 闽ICP备13013206号-7 )

GMT+8, 2024/12/26 20:37 , Processed in 0.121400 second(s), 19 queries , MemCache On.

Powered by itzmx! X3.4

© 2011- sakura

快速回复 返回顶部 返回列表