PHP静态编译开启curl扩展总是失败
编译参数
仅测试curl静态编译,所以编译参数如下:
./configure LDFLAGS="-static -static-libgcc" \
--prefix=/usr/local/php/php7.4.4/ \
--with-config-file-path=/usr/local/php/php7.4.4/ \
--with-libdir=lib/x86_64-linux-gnu \
--disable-all \
--with-curl
或者手动指定 curl 路径
./configure LDFLAGS="-static -static-libgcc" \
--prefix=/usr/local/php/php7.4.4/ \
--with-config-file-path=/usr/local/php/php7.4.4/ \
--with-libdir=lib/x86_64-linux-gnu \
--disable-all \
--with-curl=/usr/local/curl
报错内容
在 configure 阶段就产生的错误:
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
configure:4454: $? = 0
configure:4443: cc -V >&5
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
compilation terminated.
configure:4454: $? = 1
configure:4443: cc -qversion >&5
cc: error: unrecognized command line option '-qversion'; did you mean '--version'?
cc: fatal error: no input files
...
configure:4970: cc -E conftest.c
conftest.c:9:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated
...
configure:5373: checking minix/config.h usability
configure:5373: cc -c -g -O2 conftest.c >&5
conftest.c:52:10: fatal error: minix/config.h: No such file or directory
#include <minix/config.h>
^~~~~~~~~~~~~~~~
compilation terminated
...
configure:6393: checking for pthreads_cflags
configure:6423: cc -o conftest -g -O2 -fvisibility=hidden -kthread -static -static-libgcc conftest.c >&5
cc: error: unrecognized command line option '-kthread'; did you mean '-pthread'?
configure:6423: $? = 1
configure: failed program was:
...
configure:7260: cc -o conftest -g -O2 -fvisibility=hidden -static -static-libgcc conftest.c >&5
/tmp/ccKajTU1.o: In function `main':
/mnt/tools/php-7.4.4/conftest.c:62: undefined reference to `setproctitle'
collect2: error: ld returned 1 exit status
系统环境
Debian9、CentOS8 均能复现出问题
安装过 libcurl-devel
yum install -y libcurl-devel
automake、autoconf、libtool、gcc 版本:
# rpm -qf /usr/bin/autoconf
autoconf-2.69-27.el8.noarch
# automake --version
automake (GNU automake) 1.16.1
# libtool --version
libtool (GNU libtool) 2.4.6
# gcc -v
gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)
麻烦各位给予解答或者帮助,感谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关键信息少了点。
yum install glibc-static
我在centos8复现是少这个,你加上试试。还是不行的话需要config.log信息。
补充一句,装这个需要启用PowerTools源。
sed -i 's|^enabled=0|enabled=1|' /etc/yum.repos.d/CentOS-PowerTools.repo
yum install gcc gcc-c++ -y