php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64061 GD extension fails to build when png.h is not found
Submitted: 2013-01-24 10:44 UTC Modified: 2013-01-28 06:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: stephencoxmail at gmail dot com Assigned:
Status: Closed Package: GD related
PHP Version: 5.4.11 OS: Windows
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: stephencoxmail at gmail dot com
New email:
PHP Version: OS:

 

 [2013-01-24 10:44 UTC] stephencoxmail at gmail dot com
Description:
------------
When building PHP on Windows the GD extension fails to build. The problem is that 
the config.w32 searches for png.h in include/libpng12 instead of include/libpng. 
The dependencies was downloaded from http://windows.php.net/downloads/php-
sdk/deps-5.4-vc9-x86.7z

Test script:
---------------
configure --enable-mailparse=shared --enable-http=shared --with-mysqlnd --with-mysql --disable-com-dotnet --disable-ftp --disable-odbc --without-wddx --disable-cgi --enable-mbstring --enable-fileinfo=shared --with-imap=shared --enable-apc --enable-apc-srwlock-native --enable-apache2-2handler --with-mcrypt --enable-soap=shared --with-openssl=shared --enable-intl=shared --with-curl --with-mysqli --with-xmlrpc

Expected result:
----------------
The GD extension is supposed to be configured

Actual result:
--------------
The GD extension fails to be configured

Patches

GD_libpng_location_change_in_windows (last revision 2013-01-24 10:45 UTC by stephencoxmail at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-25 18:39 UTC] mirco dot babin at gmail dot com
Description:
------------
I applied the patch to PHP 5.4.10. The GD extension then still fails to build on 
Windows. Configure outputs an error about missing libXpm_a.lib.

It appears this library is not present in the dependencies from: 
http://windows.php.net/downloads/php-sdk/deps-5.4-vc9-x86.7z

Configure Statement:
--------------------
call configure "--enable-snapshot-build" "--disable-isapi" "--disable-cgi" "--
enable-cli" "--disable-nsapi" "--disable-apache" "--disable-apache2-2filter" "--
disable-apache2-2handler" "--disable-embed" "--enable-cli-win32" "--enable-
debug-pack" "--without-pi3web" "--enable-com-dotnet=shared" "--with-
mcrypt=static" > configured.txt 2>&1

Configure output:
-----------------
[..SNIP..]
Checking for library vpxmt.lib ... ..\deps\lib\vpxmt.lib
Checking for library libjpeg_a.lib;libjpeg.lib ... ..\deps\lib\libjpeg_a.lib
Checking for library freetype_a.lib;freetype.lib ... ..\deps\lib\freetype_a.lib
Checking for library libpng_a.lib;libpng.lib ... ..\deps\lib\libpng_a.lib
Checking for gd.h ...  ext\gd\libgd
Checking for png.h ...  C:\php-sdk\php54dev\vc9\x86\deps\include\libpng
Checking for library libiconv_a.lib;libiconv.lib ... ..\deps\lib\libiconv_a.lib
Checking for iconv.h ...  C:\php-sdk\php54dev\vc9\x86\deps\include
Checking for library libXpm_a.lib ... <not found>
WARNING: gd not enabled; libraries and headers not found
[..SNIP..]
 [2013-01-25 19:06 UTC] stephencoxmail at gmail dot com
You need to extract http://windows.php.net/downloads/php-sdk/deps/libxpm-3.5.10-
vc9-x86.zip in the dependencies.
 [2013-01-25 19:07 UTC] pajoye@php.net
Easier to fetch all deps at once here:

http://windows.php.net/downloads/php-sdk/
 [2013-01-25 19:20 UTC] stephencoxmail at gmail dot com
Yes, but libxpm is not included in http://windows.php.net/downloads/php-sdk/deps-
5.4-vc9-x86.7z. This is only a secondary problem, the initial problem this patch 
tries to solve is to change the path where libpng is found in deps-5.4.
 [2013-01-25 20:14 UTC] mirco dot babin at gmail dot com
After downloading again:
1) http://windows.php.net/downloads/php-sdk/deps-5.4-vc9-x86.7z
2) http://windows.php.net/downloads/php-sdk/deps/libxpm-3.5.10-vc9-x86.zip

The GD extension is enabled by configure. Building php with the new dependencies 
fails. I post the output here, but I don't think it belongs to this bug.

As a sidenote, the patch and the new dependencies 1) conflict with each other. 
The patch renames libpng12 to libpng in config.w32. 
The new dependencies install libpng12.

So it seems like there is some mis-communication what the best path is to take. 
Updating config.w32 or updating the directoryname in the dependencies.

Configure output:
-----------------
[... Snip ...]

Checking for library vpxmt.lib ... ..\deps\lib\vpxmt.lib
Checking for library libjpeg_a.lib;libjpeg.lib ... ..\deps\lib\libjpeg_a.lib
Checking for library freetype_a.lib;freetype.lib ... ..\deps\lib\freetype_a.lib
Checking for library libpng_a.lib;libpng.lib ... ..\deps\lib\libpng_a.lib
Checking for gd.h ...  ext\gd\libgd
Checking for png.h ...  C:\php-sdk\php54dev\vc9\x86\deps\include\libpng
Checking for library libiconv_a.lib;libiconv.lib ... ..\deps\lib\libiconv_a.lib
Checking for iconv.h ...  C:\php-sdk\php54dev\vc9\x86\deps\include
Checking for library libXpm_a.lib ... ..\deps\lib\libXpm_a.lib
Checking for xpm.h ...  C:\php-sdk\php54dev\vc9\x86\deps\include\X11
Checking for library T1_StaticMD.lib ... <not found>
WARNING: t1lib not enabled; libraries and headers not found

Checking for library User32.lib ... <in LIB path> User32.Lib
Checking for library Gdi32.lib ... <in LIB path> Gdi32.Lib
Enabling extension ext\gd [shared]

[... Snip ...]


Failure building:
-----------------
Generating Code...
        "cl.exe" /D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS /D LIBZEND_EXPOR
TS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500 /D COMPILE_DL_BZ2 /D COMPILE_
DL_COM_DOTNET /D COMPILE_DL_CURL /D COMPILE_DL_ENCHANT /D COMPILE_DL_FILEINFO /D
 COMPILE_DL_GD /D COMPILE_DL_GETTEXT /D COMPILE_DL_GMP /D COMPILE_DL_IMAP /D COM
PILE_DL_INTERBASE /D COMPILE_DL_INTL /D COMPILE_DL_LDAP /D COMPILE_DL_MBSTRING /
D COMPILE_DL_OPENSSL /D COMPILE_DL_PGSQL /D COMPILE_DL_SHMOP /D COMPILE_DL_SNMP
/D COMPILE_DL_SOCKETS /D COMPILE_DL_SQLITE3 /D COMPILE_DL_SYBASE_CT /D COMPILE_D
L_TIDY /D COMPILE_DL_EXIF /D COMPILE_DL_MYSQL /D COMPILE_DL_MYSQLI /D COMPILE_DL
_PDO_FIREBIRD /D COMPILE_DL_PDO_MYSQL /D COMPILE_DL_PDO_ODBC /D COMPILE_DL_PDO_P
GSQL /D COMPILE_DL_PDO_SQLITE /D COMPILE_DL_SOAP /D COMPILE_DL_XMLRPC /D COMPILE
_DL_XSL -Iext/bcmath/libbcmath/src   -Iext/date/lib /wd4244 -Dregexec=php_regexe
c -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg
/regex    /I "C:\php-sdk\php54dev\vc9\x86\deps\include"  /DHAVE_ICONV_H=1 /D PHP
_ICONV_EXPORTS  /I "C:\php-sdk\php54dev\vc9\x86\deps\include"  /DHAVE_MCRYPT_H=1
  /DHAVE_SQL_H=1 /DHAVE_SQLEXT_H=1 -Iext/pcre/pcrelib    /I "ext/date/lib"  /DHA
VE_TIMELIB_CONFIG_H=1 /I "ext\mbstring\oniguruma"  /DHAVE_ONIGURUMA_H=1  /I "C:\
php-sdk\php54dev\vc9\x86\deps\include"  /DHAVE_ZLIB_H=1 /D ZLIB_EXPORTS /I "C:\p
hp-sdk\php54dev\vc9\x86\deps\include"  /DHAVE_LIBXML_PARSER_H=1 /D LIBXML_STATIC
 /D LIBXML_STATIC_FOR_DLL /D HAVE_WIN32_THREADS /D LIBXML_STATIC   /D LIBXML_STA
TIC /D PHP_SIMPLEXML_EXPORTS /I "ext/date/lib"  /DHAVE_TIMELIB_CONFIG_H=1 /D LIB
XML_STATIC /D LIBXML_STATIC /I "C:\php-sdk\php54dev\vc9\x86\deps\include"  /DHAV
E_LIBXML_XMLWRITER_H=1 /D LIBXML_STATIC /nologo /FD /I . /I main /I Zend /I TSRM
 /I ext /D _WINDOWS /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3   /wd49
96 /D_USE_32BIT_TIME_T=1   /MP  /Zi /LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_
WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0 /D ZTS=1 /I "C:\php-sdk\php54dev\vc9\x86\
deps\include"  /D FD_SETSIZE=256  /analyze   /wd6308 /FoRelease_TS\TSRM\ /FdRele
ase_TS\TSRM\ /FpRelease_TS\TSRM\ /FRRelease_TS\TSRM\ /c TSRM\TSRM.c TSRM\tsrm_st
rtok_r.c TSRM\tsrm_virtual_cwd.c TSRM\tsrm_win32.c
TSRM.c
tsrm_strtok_r.c
tsrm_virtual_cwd.c
tsrm_win32.c
Running Code Analysis for C/C++...
c:\php-sdk\php54dev\vc9\x86\php-5.4.10-src\tsrm\tsrm_win32.c(169) : warning C601
1: Dereferencing NULL pointer 'pTokenUser': Lines: 142, 143, 144, 145, 146, 147,
 148, 151, 164, 169
c:\php-sdk\php54dev\vc9\x86\php-5.4.10-src\tsrm\tsrm_win32.c(215) : warning C632
8: 'const char' passed as parameter '1' when 'unsigned char' is required in call
 to 'isalpha'
c:\php-sdk\php54dev\vc9\x86\php-5.4.10-src\tsrm\tsrm_win32.c(543) : warning C638
7: 'argument 1' might be '0': this does not adhere to the specification for the
function 'CloseHandle': Lines: 459, 460, 461, 462, 463, 464, 465, 466, 467, 468,
 469, 470, 471, 472, 473, 475, 480, 481, 485, 486, 489, 485, 492, 493, 494, 496,
 500, 501, 503, 504, 505, 507, 508, 510, 515, 516, 517, 520, 521, 526, 529, 530,
 535, 536, 540, 541, 542, 543
c:\php-sdk\php54dev\vc9\x86\php-5.4.10-src\tsrm\tsrm_win32.c(642) : warning C601
1: Dereferencing NULL pointer 'shm->descriptor': Lines: 593, 594, 595, 596, 598,
 602, 603, 605, 606, 608, 618, 623, 624, 625, 626, 628, 642
c:\php-sdk\php54dev\vc9\x86\php-5.4.10-src\tsrm\tsrm_win32.c(644) : warning C638
7: 'argument 1' might be '0': this does not adhere to the specification for the
function 'UnmapViewOfFile': Lines: 593, 594, 595, 596, 598, 602, 603, 605, 606,
608, 618, 623, 624, 625, 626, 628, 642, 643, 644
C:\Program Files\Microsoft Visual Studio 9.0\VC\Include\tchar.h(1659) : fatal er
ror C1001: An internal error has occurred in the compiler.
(compiler file 'msc1ast.cpp', line 1411)
 To work around this problem, try simplifying or changing the program near the l
ocations listed above.
Please choose the Technical Support command on the Visual C++
 Help menu, or open the Technical Support help file for more information
Internal Compiler Error in C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\c
l.exe.  You will be prompted to send an error report to Microsoft later.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin
\cl.exe"' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin
\nmake.exe"' : return code '0x2'
Stop.
 [2013-01-25 20:23 UTC] stephencoxmail at gmail dot com
Updating the directory name in the dependencies seems like the more efficient 
option.

I got GD to build by switching to a different libpng (Can remember exactly), but 
I will post a different bug for that.
 [2013-01-25 20:49 UTC] pajoye@php.net
We use libpng12. However we are adding libpng 1.5 support and we will allow both. 
The snaps and releases use the exact same dependencies, see 
http://windows.php.net/downloads/ (phpinfo shows you the configure line, if you 
like to reproduce).
 [2013-01-25 21:20 UTC] mirco dot babin at gmail dot com
Configure now works correctly (without the patch). I downloaded the php 5.4.11 
sources and the php 5.4 dependencies. 

Unfortunately building PHP fails. I did build php 5.4.10 correctly.

Compilation is done using the steps provided in 
https://wiki.php.net/internals/windows/stepbystepbuild on:
- Windows/XP in a VirtualBox (fully updated)
- Microsoft Visual Studio 2008 Express
- Windows SDK 6.1 command prompt (don't use the Visual Studio command prompt, as 
it does not execute SETENV correctly)

call configure "--enable-snapshot-build" "--disable-isapi" "--disable-cgi" "--
enable-cli" "--disable-nsapi" "--disable-apache" "--disable-apache2-2filter" "--
disable-apache2-2handler" "--disable-embed" "--enable-cli-win32" "--enable-
debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--
enable-com-dotnet=shared" "--with-mcrypt=static" > configured.txt 2>&1

nmake snap > compilation.txt 2>&1

I don't know how to upload compilation.txt into this bug database. Pasting is 
refused (probably too big).
 [2013-01-25 21:35 UTC] mirco dot babin at gmail dot com
Regarding my previous comment, I uploaded compilation.txt to pastebin. You can see 
it at http://pastebin.com/p07WQCAU
 [2013-01-26 07:17 UTC] pajoye@php.net
You only need to copy the error here, not the full log.
 [2013-01-26 07:17 UTC] pajoye@php.net
btw, you can also compile only using the SDK, it includes the compilation tools 
suite.
 [2013-01-28 06:22 UTC] stephencoxmail at gmail dot com
GD can be build without the patch using the new deps-5.4 archive
 [2013-01-28 06:22 UTC] stephencoxmail at gmail dot com
-Status: Open +Status: Closed
 [2013-02-01 21:15 UTC] mirco dot babin at gmail dot com
My compilation problems seem to be related to the "/analyze" option of the 
Visual Studio compiler cl.exe. After searching the internet I noticed others 
expirienced also crashes with /analyze.

After specifying "--enable-static-analyze=no" php compiles correctly.

call configure "--enable-snapshot-build" "--disable-isapi" "--disable-cgi" "--
enable-cli" "--disable-nsapi" "--disable-apache" "--disable-apache2-2filter" "--
disable-apache2-2handler" "--disable-embed" "--enable-cli-win32" "--enable-
debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--
enable-com-dotnet=shared" "--with-mcrypt=static" "--enable-static-analyze=no" > 
configured.txt 2>&1

Thanks for your attention!
Regards,
Mirco Babin
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC