You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译PHP 8.1.20指定新版ICU 73.2失败问题求助

在CentOS 7编译PHP 8.1.20搭配ICU 73.2时的make失败问题

问题现象

  • 在CentOS 7系统编译PHP 8.1.20,计划搭配新版ICU 73.2为intl扩展提供支持,ICU自身编译过程无异常
  • 未指定ICU_LIBS="/usr/local/libicu/lib"参数时,PHP的make过程可正常完成
  • 手动指定该参数后,make过程失败,错误信息显示编译时仍在调用系统自带的ICU 50.2版本,而非手动编译的73.2版本

错误根源分析

系统通过yum安装了低版本ICU包:

rpm -qa | grep icu
libicu-50.2-4.el7_7.x86_64
libicu-devel-50.2-4.el7_7.x86_64

尽管PHP的Makefile中已配置指向ICU 73.2的库路径,但编译链接阶段仍优先调用了系统默认的ICU 50.2库文件,导致头文件与库版本不匹配,出现符号链接错误。

编译配置参数

export LD_LIBRARY_PATH=/usr/local/libicu/lib
CC=/opt/rh/devtoolset-9/root/usr/bin/gcc \
CXX=/opt/rh/devtoolset-9/root/usr/bin/g++ \
CFLAGS="-O3 -march=nocona -mtune=nocona -funroll-all-loops -m64 -pipe -fomit-frame-pointer -msse -mmmx -msse2 -msse3 -mfpmath=sse" \
CXXFLAGS="-O3 -march=nocona -mtune=nocona -funroll-all-loops -m64 -pipe -fomit-frame-pointer -msse -mmmx -msse2 -msse3 -mfpmath=sse" \
ICU_LIBS="/usr/local/libicu/lib" \
LIBS=-lpthread \
    ./configure \
    --prefix=/usr/local/php-8.1.20 \
    --enable-fpm \
    --with-openssl \
    --with-zlib \
    --with-zlib-dir \
    --with-bz2 \
    --enable-ctype \
    --enable-calendar \
    --with-curl \
    --with-mhash \
    --enable-sockets \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    --with-zip \
    --enable-mbstring \
    --enable-bcmath \
    --with-iconv \
    --enable-sigchild \
    --enable-gd \
    --with-jpeg \
    --with-freetype \
    --enable-mysqlnd \
    --with-mysqli \
    --with-pdo-mysql \
    --with-gettext \
    --with-ldap \
    --with-pdo-pgsql \
    --with-pgsql \
    --enable-intl

系统与编译器信息

  • 系统内核版本:
Linux somehost 3.10.0-1062.4.1.el7.x86_64 #1 SMP Fri Oct 18 17:15:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • GCC编译器版本:
gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

内容的提问来源于stack exchange,提问作者rensar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 01:47:43