Archlinux PHP-8.2.12 源代码构建

问题描述 投票:0回答:1

我无法在 Arch Linux 上从源代码编译最新的 PHP。 我查找了几个如何安装文档,但它们适用于 Ubuntu/Debian。 我是否缺少库或者我需要指定 cflags 或其他内容?

安装过程

pacman -S --needed --noconfirm base base-devel libpqxx libsodium tidy libxml2 libxslt libxmlb libzip re2c libgccjit libzip autoconf bison

yay --noconfirm c-client imap

git clone -b "PHP-8.2.12" --single-branch https://github.com/php/php-src.git

cd php-src/

./buildconf --force

./configure --prefix=/usr/local --enable-fpm --with-fpm-systemd --with-fpm-acl --with-fpm-apparmor --enable-debug --enable-zts --with-openssl \
        --with-system-ciphers --with-pcre-jit --with-zlib --enable-bcmath --enable-calendar --with-curl --with-lmdb --enable-exif --with-ffi --enable-ftp \
        --with-webp --with-jpeg --with-xpm --with-freetype --with-imap --with-imap-ssl --enable-intl --with-ldap --enable-mbstring --with-mysqli --with-mysql-sock \
        --with-pgsql --with-readline --enable-soap --enable-sockets --with-sodium --with-tidy --with-xsl --with-zip --enable-mysqlnd --with-pear --with-kerberos

make -j$(nproc)

犯错误

...

/bin/sh /root/php-src/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -Iext/dom/ -I/root/php-src/ext/dom/ -I/root/php-src/include -I/root/php-src/main -I/root/php-src -I/root/php-src/ext/date/lib -I/usr/include/libxml2 -I/usr/include/imap -I/root/php-src/ext/mbstring/libmbfl -I/root/php-src/ext/mbstring/libmbfl/mbfl -I/root/php-src/TSRM -I/root/php-src/Zend  -D_GNU_SOURCE -D_REENTRANT -I/usr/include/imap -pthread  -fno-common -Wstrict-prototypes -Wformat-truncation -Wlogical-op -Wduplicated-cond -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -g -fvisibility=hidden -pthread -O0 -Wimplicit-fallthrough=1 -DZTS -DZEND_SIGNALS    -c /root/php-src/ext/dom/domexception.c -o ext/dom/domexception.lo  -MMD -MF ext/dom/domexception.dep -MT ext/dom/domexception.lo
/bin/sh /root/php-src/libtool --silent --preserve-dup-deps --tag CC --mode=compile cc -Iext/dom/ -I/root/php-src/ext/dom/ -I/root/php-src/include -I/root/php-src/main -I/root/php-src -I/root/php-src/ext/date/lib -I/usr/include/libxml2 -I/usr/include/imap -I/root/php-src/ext/mbstring/libmbfl -I/root/php-src/ext/mbstring/libmbfl/mbfl -I/root/php-src/TSRM -I/root/php-src/Zend  -D_GNU_SOURCE -D_REENTRANT -I/usr/include/imap -pthread  -fno-common -Wstrict-prototypes -Wformat-truncation -Wlogical-op -Wduplicated-cond -Wno-clobbered -Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare -g -fvisibility=hidden -pthread -O0 -Wimplicit-fallthrough=1 -DZTS -DZEND_SIGNALS    -c /root/php-src/ext/dom/parentnode.c -o ext/dom/parentnode.lo  -MMD -MF ext/dom/parentnode.dep -MT ext/dom/parentnode.lo
/root/php-src/ext/dom/document.c: In function ‘zim_DOMDocument_save’:
/root/php-src/ext/dom/document.c:1434:29: error: ‘xmlSaveNoEmptyTags’ undeclared (first use in this function)
 1434 |                 saveempty = xmlSaveNoEmptyTags;
      |                             ^~~~~~~~~~~~~~~~~~
/root/php-src/ext/dom/document.c:1434:29: note: each undeclared identifier is reported only once for each function it appears in
/root/php-src/ext/dom/document.c: In function ‘zim_DOMDocument_saveXML’:
/root/php-src/ext/dom/document.c:1486:37: error: ‘xmlSaveNoEmptyTags’ undeclared (first use in this function)
 1486 |                         saveempty = xmlSaveNoEmptyTags;
      |                                     ^~~~~~~~~~~~~~~~~~
/root/php-src/ext/dom/document.c: In function ‘zim_DOMDocument_xinclude’:
/root/php-src/ext/dom/document.c:1582:9: warning: ‘__xmlLoadExtDtdDefaultValue’ is deprecated [-Wdeprecated-declarations]
 1582 |         PHP_LIBXML_SANITIZE_GLOBALS(xinclude);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/libxml2/libxml/parser.h:13,
                 from /root/php-src/ext/dom/php_dom.h:29,
                 from /root/php-src/ext/dom/document.c:24:
/usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
  499 |     attrs XMLPUBFUN type *__##name(void);
      |                           ^~
/usr/include/libxml2/libxml/parser.h:854:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
  854 | #define XML_OP XML_DECLARE_GLOBAL
      |                ^~~~~~~~~~~~~~~~~~

...

# grep -rl xmlSaveNoEmptyTags
ext/libxml/php_libxml2.def
ext/dom/document.c

# cat /proc/version 
Linux version 6.6.1-arch1-1 (linux@archlinux) (gcc (GCC) 13.2.1 20230801, GNU ld (GNU Binutils) 2.41.0) #1 SMP PREEMPT_DYNAMIC Wed, 08 Nov 2023 16:05:38 +0000
php linux compiler-errors archlinux
1个回答
0
投票

我也可以使用 libxml2 2.12.0 和 PHP 8.2.13 进行重现。 这是由于此 libxml2 版本中的重大标头更改所致。

https://github.com/php/php-src/commit/8a95e616b91ac0eeedba90a61e36e652919763f2 为我解决了。

© www.soinside.com 2019 - 2024. All rights reserved.