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: 2021-12-01 06:56 UTC
From: mtbox74 at gmail dot com Assigned: remi (profile)
Status: Assigned Package: Compile Failure
PHP Version: 7.4.25 OS: Xubuntu 18.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 29 13:03:36 2022 UTC