php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77876 PHP linked with system version of libpng
Submitted: 2019-04-11 07:40 UTC Modified: 2019-05-04 13:03 UTC
From: mrskman at gmail dot com Assigned: petk (profile)
Status: Closed Package: *Compile Issues
PHP Version: 7.3.4 OS: Linux (Ubuntu 12.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: mrskman at gmail dot com
New email:
PHP Version: OS:

 

 [2019-04-11 07:40 UTC] mrskman at gmail dot com
Description:
------------
It looks like PHP is linking with wrong version of libpng if you use another version using --with-png-dir and a system version of the library is installed.

I built PHP  with --with-png-dir=/opt/httpd/2.4.39/build and during some testing I was getting this error:
libpng warning: Application was compiled with png.h from libpng-1.6.35
libpng warning: Application  is  running with png.c from libpng-1.2.46
Segmentation fault (core dumped)

Then I found that PHP was linked with the system version of libpng:
ldd /opt/httpd/2.4.39/build/bin/php7 | grep png
	libpng12.so.0 => /usr/lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f38e84fb000)

After removing libpng12-dev from my system I recompiled PHP with the same command and it is OK now:
ldd /opt/httpd/2.4.39/build/bin/php7 | grep png
	libpng16.so.16 => /opt/httpd/2.4.39/build/lib/libpng16.so.16 (0x00007f884dd54000)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-11 11:54 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-04-11 11:54 UTC] cmb@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP 7.1 no longer receives fixes for regular bugs (only security fixes).
 [2019-04-12 23:00 UTC] mrskman at gmail dot com
-PHP Version: 7.1.28 +PHP Version: 7.3.4
 [2019-04-12 23:00 UTC] mrskman at gmail dot com
I can reproduce this issue also with 7.2.17 and 7.3.4 versions
 [2019-04-13 08:01 UTC] cmb@php.net
-Status: Not a bug +Status: Open
 [2019-04-13 08:01 UTC] cmb@php.net
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2019-04-14 18:51 UTC] petk@php.net
Hello, PHP <= 7.3 versions using custom compiled libpng libraries that are installed on custom locations can be done using:

    ./configure --with-gd --with-png-dir=/path/to/libpng/usr/local

Note the `usr/local` attached at the end. The config.m4 file checking for the location will first check for the custom location provided with the configure option, then go to system /usr/include directory and so on.

http://git.php.net/?p=php-src.git;a=blob;f=ext/gd/config.m4;h=498d870785e86ff4a49d87082e3fed2a4c4d32f9;hb=refs/heads/PHP-7.3#l129


PHP 7.4 is using pkg-config so something like this won't work anymore. There the environment variables will need to be used in front of ./configure command...
 [2019-04-14 18:56 UTC] spam2 at rhsoft dot net
this remains a bug

what is the point of need env vars in case one supplied a pretty clear argument to configure itself - just set that var implicit instead blindly use pkgcongig when told not to do
 [2019-04-14 23:06 UTC] petk@php.net
So, what needs to be fixed here? It all works ok. Yes? On prehistoric Linux versions such as Ubuntu 12.04 that aren't supported upstream either anymore, PHP later versions most certainly won't be possible to compile without major patches and adjustments anyway...
 [2019-04-14 23:28 UTC] spam2 at rhsoft dot net
> So, what needs to be fixed here? It all works ok. Yes?

PHP <= 7.3 versions using custom compiled libpng libraries that are installed on custom locations can be done using: --with-png-dir=/path/to/libpng/usr/local

"PHP 7.4 is using pkg-config so something like this won't work anymore. There the environment variables will need to be used in front of ./configure command..."
 [2019-05-04 13:03 UTC] petk@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: petk
 [2019-05-04 13:03 UTC] petk@php.net
This is then resolved for the PHP 7.3.

For the PHP 7.4, they have migrated to pkg-config so to override the libpng there:

PNG_CFLAGS=-I/path/to/libpng/include/ \
PNG_LIBS=/path/to/libpng/lib \
./configure --enable-mbstring

In case these should be done somehow differently solved, please send a pull request to check it out (keep in mind that there are now several extensions already using this, so things need to be consistent with other extensions). Environment variables might seem a bit weird but you get used to them also. The migration hasn't been done by me though :). Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 10 15:01:28 2024 UTC