php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64785 Compile fails using --with-gd
Submitted: 2013-05-07 21:42 UTC Modified: 2013-05-08 17:05 UTC
From: [email protected] Assigned: remi (profile)
Status: Closed Package: GD related
PHP Version: 5.5Git-2013-05-07 (Git) OS: Linux
Private report: No CVE-ID: None
 [2013-05-07 21:42 UTC] [email protected]
Description:
------------
In PHP 5.5, using "./configure --with-gd" causes compilation failure. It works in PHP 5.4.  The compilation errors after doing "./configure --with-gd" are:

ext/gd/libgd/.libs/gd_png.o: In function `php_gd_gdImagePngCtxEx':
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:482: undefined reference to `png_create_write_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:491: undefined reference to `png_create_info_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:502: undefined reference to `png_destroy_write_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:508: undefined reference to `png_set_write_fn'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:524: undefined reference to `png_set_compression_level'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:526: undefined reference to `png_set_filter'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:581: undefined reference to `png_set_IHDR'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:664: undefined reference to `png_write_info'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:667: undefined reference to `png_set_packing'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:720: undefined reference to `png_write_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:721: undefined reference to `png_write_end'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:754: undefined reference to `png_destroy_write_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:494: undefined reference to `png_destroy_write_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:577: undefined reference to `png_set_IHDR'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:590: undefined reference to `png_set_tRNS'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:637: undefined reference to `png_set_tRNS'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:660: undefined reference to `png_set_PLTE'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:739: undefined reference to `png_write_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:740: undefined reference to `png_write_end'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:574: undefined reference to `png_set_IHDR'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:748: undefined reference to `png_write_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:749: undefined reference to `png_write_end'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:720: undefined reference to `png_write_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:721: undefined reference to `png_write_end'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:739: undefined reference to `png_write_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:740: undefined reference to `png_write_end'
ext/gd/libgd/.libs/gd_png.o: In function `gdPngWriteData':
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:86: undefined reference to `png_get_io_ptr'
ext/gd/libgd/.libs/gd_png.o: In function `gdPngErrorHandler':
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:66: undefined reference to `png_get_error_ptr'
ext/gd/libgd/.libs/gd_png.o: In function `php_gd_gdImageCreateFromPngCtx':
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:149: undefined reference to `png_sig_cmp'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:154: undefined reference to `png_create_read_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:163: undefined reference to `png_create_info_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:188: undefined reference to `png_set_sig_bytes'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:190: undefined reference to `png_set_read_fn'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:191: undefined reference to `png_read_info'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:193: undefined reference to `png_get_IHDR'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:296: undefined reference to `png_set_gray_to_rgb'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:304: undefined reference to `png_get_valid'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:305: undefined reference to `png_get_tRNS'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:319: undefined reference to `png_read_update_info'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:322: undefined reference to `png_get_rowbytes'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:332: undefined reference to `png_read_image'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:333: undefined reference to `png_read_end'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:357: undefined reference to `png_destroy_read_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:274: undefined reference to `png_get_valid'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:275: undefined reference to `png_get_tRNS'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:231: undefined reference to `png_get_PLTE'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:235: undefined reference to `png_get_valid'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:243: undefined reference to `png_get_tRNS'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:210: undefined reference to `png_set_packing'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:208: undefined reference to `png_set_strip_16'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:257: undefined reference to `png_destroy_read_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:219: undefined reference to `png_destroy_read_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:166: undefined reference to `png_destroy_read_struct'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:202: undefined reference to `png_destroy_read_struct'
ext/gd/libgd/.libs/gd_png.o: In function `gdPngReadData':
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:78: undefined reference to `png_get_io_ptr'
/home/cjones/php-5.5/ext/gd/libgd/gd_png.c:80: undefined reference to `png_error'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1


One workaround is to do: "./configure --with-gd --with-png-dir"



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-08 05:31 UTC] [email protected]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: remi
 [2013-05-08 05:34 UTC] [email protected]
I don't think it works in 5.4

libpng is mandatory and cannot be disabled.

checking for GD support... yes
checking for the location of libvpx... no
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-vpx-dir=<DIR>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: png.h not found.


I will restore this behaviour in 5.5.
 [2013-05-08 05:37 UTC] [email protected]
-Status: Assigned +Status: Closed
 [2013-05-08 05:37 UTC] [email protected]
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=36eee5b994a1da413330f96020c3dec1378a89f7
Log: Fixed bug #64785 : restore 5.4 behaviour, libpng is mandatory
 [2013-05-08 17:05 UTC] [email protected]
Thanks for restoring this.  With PHP 5.4 & PHP 5.5 it now works similarly:

$ ~/php-5.4/configure --with-gd
...
checking for GD support... yes
checking for the location of libvpx... no
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
If configure fails try --with-jpeg-dir=<DIR>
If configure fails try --with-vpx-dir=<DIR>
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
If configure fails try --with-freetype-dir=<DIR>
checking for GNU gettext support... no
checking for GNU MP support... no
...

Configuration continues & compilation succeeds.
 [2013-11-17 09:31 UTC] [email protected]
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=36eee5b994a1da413330f96020c3dec1378a89f7
Log: Fixed bug #64785 : restore 5.4 behaviour, libpng is mandatory
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Jan 12 17:00:01 2026 UTC