ID: 31396 Updated by: [EMAIL PROTECTED] Reported By: brooks at netgate dot net -Status: Open +Status: Assigned Bug Type: GD related Operating System: * PHP Version: 4.3.10 -Assigned To: +Assigned To: sniper New Comment:
It's time we start using the gdlib-config script they provide nowadays. No more hacks. :) Previous Comments: ------------------------------------------------------------------------ [2005-01-04 00:14:56] brooks at netgate dot net 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 this bug report at http://bugs.php.net/?id=31396&edit=1