php7.4.30 源码编译报错 undefined reference to `libiconv_open‘

php7.4.30编译报错

1、编译

./configure --prefix=/data/program/php74 --with-config-file-path=/data/program/php74/etc \
--with-freetype=/data/program/freetype --enable-mysqlnd --with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-jpeg \
--enable-ftp --enable-xml --disable-rpath --enable-bcmath --enable-shmop \
--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring \
--with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-fpm --with-xmlrpc \
--enable-soap --enable-opcache=no --with-pear --with-zlib=/data/program/zlib \
--with-xpm=/usr/lib CPP=/usr/bin/cpp

2、make

make的时候报错了

[root@localhost php-7.4.30]# make -j4
......
ext/xmlrpc/libxmlrpc/encodings.o: In function `convert':
/data/software/php-7.4.30/ext/xmlrpc/libxmlrpc/encodings.c:63: undefined reference to `libiconv_open'
/data/software/php-7.4.30/ext/xmlrpc/libxmlrpc/encodings.c:70: undefined reference to `libiconv'
/data/software/php-7.4.30/ext/xmlrpc/libxmlrpc/encodings.c:86: undefined reference to `libiconv_close'
/data/software/php-7.4.30/ext/xmlrpc/libxmlrpc/encodings.c:86: undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1
make: *** 正在等待未完成的任务....
ext/iconv/iconv.o: In function `php_iconv_stream_filter_dtor':
......
解决方法

1、编辑Makefile

vim Makefile
#找到下面这行:
EXTRA_LIBS = -lcrypt ...
# 在行末添加 -liconv

例:
在这里插入图片描述
2、源码安装libiconv

wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
tar -zxvf libiconv-1.17.tar.gz
cd libiconv-1.17
./configure --prefix=/usr/local/libiconv --enable-static --disable-shared --host=$host
make -j4
make install

安装完成后,将这一句 --with-iconv=/usr/local/libiconv/ 添加到编译PHP ./configure … 的最后面

例:

./configure --prefix=/data/program/php74 --with-config-file-path=/data/program/php74/etc \
--with-freetype=/data/program/freetype --enable-mysqlnd --with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-jpeg \
--enable-ftp --enable-xml --disable-rpath --enable-bcmath --enable-shmop \
--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring \
--with-openssl --with-mhash --enable-pcntl --enable-sockets --enable-fpm --with-xmlrpc \
--enable-soap --enable-opcache=no --with-pear --with-zlib=/data/program/zlib \
--with-xpm=/usr/lib CPP=/usr/bin/cpp --with-iconv=/usr/local/libiconv/

<记得在重新编译PHP的时候 需要make clean>

然后重新./configure 和 make
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值