php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78823 ZLIB_LIBS not added to EXTRA_LIBS
Submitted: 2019-11-16 22:31 UTC Modified: 2019-11-18 08:53 UTC
From: build+php at de-korte dot org Assigned:
Status: Closed Package: *Compile Issues
PHP Version: 7.4.0RC6 OS: Linux
Private report: No CVE-ID: None
 [2019-11-16 22:31 UTC] build+php at de-korte dot org
Description:
------------
Configure finds ZLIB_LIBS='-L/lib64 -lz ' without problems, but these are not added to EXTRA_LIBS despite having --with-zlib=shared. Adding '-lz' manually does fix this, but I wonder why this now breaks. Up to and including 7.3.11 this worked out of the box with similar configure input.



Patches

php-fix-mysqlnd-compression-library.patch (last revision 2019-11-19 14:56 UTC by build+php at de-korte dot org)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-17 18:30 UTC] build+php at de-korte dot org
Error message:
[ 1091s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: ext/mysqlnd/.libs/mysqlnd_protocol_frame_codec.o: undefined reference to symbol 'compress'
[ 1091s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /lib64/libz.so.1: error adding symbols: DSO missing from command line

Libraries passed to the linker:
-lcrypt -largon2 -lresolv -lcrypt -lrt -lstdc++ -lrt -lm -ldl -ltinfo -lxml2 -lpcre2-8 -lxml2 -lcrypt -largon2 -lxml2 -lssl -lcrypto -lcrypt

Obviously, '-lz' is missing here and adding that to LIBS fixes the build.
 [2019-11-18 08:53 UTC] build+php at de-korte dot org
The problem is newer binutils will no longer default to --copy-dt-needed-entries but use --no-copy-dt-needed-entries instead. So all libraries needed must be provided. This is the reason this previously, as openSUSE only recently switched to a binutils where this is changed.

Workarounds (either one works)
1) Add "-Wl,--copy-dt-needed-entries" to LDFLAGS to bring back the old behavior of the linker
2) Add "-lz" to LIBS

It would be best though to make sure all libraries are explicitly linked in. IN "ext/mysqlnd/mysqlnd_protocol_frame_codec.c" when the "zlib.h" header is included should also trigger adding ZLIB_LIBS to the list of libraries.
 [2019-11-19 14:56 UTC] build+php at de-korte dot org
The following patch has been added/updated:

Patch Name: php-fix-mysqlnd-compression-library.patch
Revision:   1574175413
URL:        https://bugs.php.net/patch-display.php?bug=78823&patch=php-fix-mysqlnd-compression-library.patch&revision=1574175413
 [2019-11-26 07:41 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #78823: add zlib library to mysqlnd
On GitHub:  https://github.com/php/php-src/pull/4945
Patch:      https://github.com/php/php-src/pull/4945.patch
 [2019-12-05 06:25 UTC] nikic@php.net
Automatic comment on behalf of build+github@de-korte.org
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ee4295b4ce421003c2e1d2af98066826deb23319
Log: Fix bug #78823: add zlib library to mysqlnd
 [2019-12-05 06:25 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jan 27 18:01:24 2020 UTC