Bug #81613 [Com]: impossible to compile php with zip support

From: Date: Wed, 04 Jan 2023 09:48:36 +0000
Subject: Bug #81613 [Com]: impossible to compile php with zip support
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243326@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81613&edit=1

 ID:                 81613
 Comment by:         croverwnorene8 at gmail dot com
 Reported by:        mtbox74 at gmail dot com
 Summary:            impossible to compile php with zip support
 Status:             Assigned
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Xubuntu 18.04
 PHP Version:        7.4.25
 Assigned To:        remi
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for sharing about that. I am looking for more information about it. I will follow you to
update the latest posts. 

(https://www.mygeorgiasouthern.net/)github.com


Previous Comments:
------------------------------------------------------------------------
[2021-12-01 06:56:01] remi@php.net

1/ pkg_config for libpq is only available on recent version, so missing in RHEL / CentOS 7
(maintained until 2024), but I don't think switching to pkg_config will really help here

2/ problem is really an option (-L, -l) order issue

3/ this will never happen in a sane env, with a single "devel" of each library

=> remove libzip.pc / libzip.so in base system (libzip-dev package ?)

4/ problem is that we don't support library with full path

Our build system only support -L/path -lname
While linker also support -l/path/name

BTW, I really think this is something we cannot fix in a simple way, without a big change to our
build system

Again, such bad things may always happen, known limitation of PHP build system, but will never
happen on a clean build env.

------------------------------------------------------------------------
[2021-11-12 09:52:39] nikic@php.net

At a guess, this happens because pdo_pgsql explicitly adds a system libdir via
-L/usr/lib/x86_64-linux-gnu before the custom libdir for libzip -L/usr/local/libzip/1_5_2/lib. This
happens because "pq_config --libdir" is used. "pkg-config --libs libpq" would
return the correct result of "-lpq" only.

Assigning this to remi because he objected to the pkg-config migration last time, due to lack of
support on some old distros. Has enough time passed that we can migrate libpq detection to
pkg-config now?

------------------------------------------------------------------------
[2021-11-12 00:21:46] mtbox74 at gmail dot com

Description:
------------
I'm getting this error when combining --with-zlib --with-zip --with-pdo-pgsql. It says:

ext/zip/.libs/php_zip.o: In function `c_ziparchive_setEncryptionName':
/trusty/Downloads/php-7.4.25/ext/zip/php_zip.c:2254: undefined reference to
`zip_file_set_encryption'
ext/zip/.libs/php_zip.o: In function `c_ziparchive_setEncryptionIndex':
/trusty/Downloads/php-7.4.25/ext/zip/php_zip.c:2278: undefined reference to
`zip_file_set_encryption'
ext/zip/.libs/php_zip.o: In function `zm_startup_zip':
/trusty/Downloads/php-7.4.25/ext/zip/php_zip.c:3199: undefined reference to
`zip_libzip_version'
ext/zip/.libs/php_zip.o: In function `zm_info_zip':
/trusty/Downloads/php-7.4.25/ext/zip/php_zip.c:3233: undefined reference to
`zip_libzip_version'
collect2: error: ld returned 1 exit status
Makefile:293: recipe for target 'sapi/cli/php' failed
make: *** [sapi/cli/php] Error 1


If I remove --with-pdo-pgsql no errors appears.
I've installed manually zlib 1.5.2 to use encryptions methods provided by zip.
I can compile with pdo-mysql but not with pdo-pgsql :(

I got the same error compiling against latest version of php7.3 & PHP8.0
The workaround I found is to compile zip as a dynamic extension.

Full Trace: https://gist.github.com/nordin74/e56b02c12ca2f1483bee988ea6f73bf5


Test script:
---------------
./configure  \
--prefix=/home/will/php_7.4_fpm  \
--with-curl  \
--with-xsl  \
--with-pdo-mysql  \
--enable-soap  \
--enable-mbstring  \
--enable-bcmath  \
--enable-sockets  \
--enable-calendar  \
--enable-exif  \
--enable-ftp  \
--with-openssl  \
--enable-sysvmsg  \
--enable-sysvsem  \
--enable-sysvshm  \
--with-bz2=/usr  \
--with-gettext  \
--enable-gd  \
--with-freetype  \
--with-mysqli  \
--with-readline  \
--with-zlib  \
--with-zip  \
--enable-fpm  \
--enable-opcache  \
--with-jpeg  \
--enable-intl  \
--enable-pcntl  \
--enable-maintainer-zts  \
--with-pdo-pgsql

Expected result:
----------------
compile without error

Actual result:
--------------
error


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81613&edit=1


Thread (5 messages)

« previous php.bugs (#243326) next »