php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81613 impossible to compile php with zip support
Submitted: 2021-11-12 00:21 UTC Modified: 2024-07-13 23:26 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mtbox74 at gmail dot com Assigned: remi (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.4.25 OS: Xubuntu 18.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mtbox74 at gmail dot com
New email:
PHP Version: OS:

 

 [2021-11-12 00:21 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-12 09:52 UTC] nikic@php.net
-Assigned To: +Assigned To: remi
 [2021-11-12 09:52 UTC] 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-12-01 06:56 UTC] 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.
 [2023-01-04 09:48 UTC] croverwnorene8 at gmail dot com
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
 [2024-07-05 10:34 UTC] jeffrey597doss at outlook dot com
That's great. I was impressed by your writing. I am happy to see such a topic. Please come to my blog and read it. (https://github.com)(https://www.upsers-ups.com)
 [2024-07-13 23:26 UTC] petk@php.net
-Status: Assigned +Status: Closed
 [2024-07-13 23:26 UTC] petk@php.net
Hello, in upcoming PHP-8.4 there is also pkg-config support added to pgsql and pdo_pgsql extensiosn which might resolve this and similar issues. In case you're still experiencing this, please reopen a bug on https://github.com/php/php-src/issues and we'll go from there what can be done. Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 18:01:31 2024 UTC