From: brooks at netgate dot net Operating system: Various (BSD/Linux) PHP version: 4.3.10 PHP Bug Type: Compile Failure Bug description: Compile fails when using native libGD vs. built-in GD library
Description: ------------ Compiling 4.3.10 with libGD (not the included GD library) without Freetype resulted the following error: lclient -lgd -lpng -lz -lz -lm -ldl -o sapi/cgi/php ext/gd/gd.o: In function `zm_deactivate_gd': ext/gd/gd.o(.text+0x8933): undefined reference to `gdFreeFontCache' *** Error code 1 This is similar to several other reported, yet never resolved (really) bugs (ex. 24310). Here is the story... libGD (2.0.33) now defines a function (dealing with FreeType) even if you don't have FreeType installed. The function just returns a nice error message stating as much :-). So, when the configure script for PHP tried to determine if the function was included in GD (so it could set up an ifdef statement) it found it and assumed you have Freetype support. Unfortunately there really isn't ay FreeType support so the function (gdFreeFontCache) it tried to include (only included if you have FreeType support) caused the compile to fail with an undefined reference error. The solution was to do a better job with the ifdef statement within the gd.c source file. I tried to do some "tricky" stuff in the configure script. But, it's really stupid and only cares if the damn code snippit compiles, not if it actually returns an error, or not. I guess you might be able to change the config script to look for gdFreeFontCache() instead of gdImageStringFT() but I just added some more rules to one of the ifdef statements in gd.c to fix things, just in case the test for gdImageStringFT() for other "more useful" things. Here is the patch to etc/gd/gd.c Apply with patch -p0 < gd.patch vs: {94} % more gd.patch *** gd.c.orig Thu Dec 23 14:14:54 2004 --- gd.c Thu Dec 23 14:14:54 2004 *************** *** 289,295 **** PHP_MINIT(gd), NULL, NULL, ! #if HAVE_LIBGD20 && HAVE_GD_STRINGFT PHP_RSHUTDOWN(gd), #else NULL, --- 289,298 ---- PHP_MINIT(gd), NULL, NULL, ! // brooks ! // #if HAVE_LIBGD20 && HAVE_GD_STRINGFT ! #if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFT ! // end brooks PHP_RSHUTDOWN(gd), #else NULL, *************** *** 382,388 **** /* {{{ PHP_RSHUTDOWN_FUNCTION */ ! #if HAVE_LIBGD20 && HAVE_GD_STRINGFT PHP_RSHUTDOWN_FUNCTION(gd) { #if defined(HAVE_GD_THREAD_SAFE) || defined(HAVE_GD_BUNDLED) --- 385,394 ---- /* {{{ PHP_RSHUTDOWN_FUNCTION */ ! /* brooks */ ! // #if HAVE_LIBGD20 && HAVE_GD_STRINGFT ! #if HAVE_LIBGD20 && HAVE_LIBFREETYPE && HAVE_GD_STRINGFT ! /* end brooks */ PHP_RSHUTDOWN_FUNCTION(gd) { #if defined(HAVE_GD_THREAD_SAFE) || defined(HAVE_GD_BUNDLED) Reproduce code: --------------- PROG_SENDMAIL="/usr/sbin/sendmail" \ CFLAGS="-O3" \ LDFLAGS="-L/usr/local/lib -I/usr/local/include" \ LD_RUN_PATH="/usr/local/lib;/usr/local/mysql/lib/mysql" \ CC=/usr/bin/gcc ./configure \ --with-mysql=/usr/local/mysql\ --enable-force-cgi-redirect\ --with-gd=/usr/local\ --without-freetype\ --without-ttf\ --with-jpeg\ --with-png\ --with-png-dir=/usr/local\ --with-zlib\ --with-zlib-dir=/usr/local\ --with-mm=/usr/local/mm\ --prefix=/usr/local -- Edit bug report at http://bugs.php.net/?id=31396&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31396&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31396&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31396&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31396&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31396&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31396&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31396&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31396&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31396&r=support Expected behavior: http://bugs.php.net/fix.php?id=31396&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31396&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31396&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31396&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31396&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31396&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31396&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31396&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31396&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31396&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31396&r=mysqlcfg