php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46015 Build fails with system gd
Submitted: 2008-09-07 07:21 UTC Modified: 2009-08-17 08:42 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: Fedora at FamilleCollet dot com Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.3.0alpha2 OS: Linux (Fedora 9)
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: Fedora at FamilleCollet dot com
New email:
PHP Version: OS:

 

 [2008-09-07 07:21 UTC] Fedora at FamilleCollet dot com
Description:
------------
Build fails when trying to use system GD

--with-gd=shared,/usr

This is because gdhelpers only provided by bundled library.

Trivial patch proposal :
--- ext/gd/gd.c.orig	2008-09-07 08:53:38.000000000 +0200
+++ ext/gd/gd.c	2008-09-07 08:54:03.000000000 +0200
@@ -74,7 +74,9 @@
 #include <gdfontmb.h> /* 3 Medium bold font */
 #include <gdfontl.h>  /* 4 Large font */
 #include <gdfontg.h>  /* 5 Giant font */
+#if HAVE_GD_BUNDLED
 #include <gdhelpers.h>
+#endif
 
 #ifdef HAVE_GD_WBMP
 #include "libgd/wbmp.h"

Reproduce code:
---------------
make

Expected result:
----------------
Build complete.

Actual result:
--------------
Build failed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-08 10:26 UTC] spheroid@php.net
Had the same problem and came up with similar fix. Would someone apply 
this patch to CVS? My karma is not sufficient.
 [2008-09-08 10:57 UTC] pajoye@php.net
This patch is not correct as then the function defined in gdhelper.h will not be defined and the default signature will be used. please do not apply it, I will fix the issue while working on another similar issue in gd.
 [2008-12-05 08:56 UTC] karsten at typo3 dot org
I had the same issue yesterday and switched to the bundled GD to make it 
compile. Now, it would be interesting to know what functionality 
difference this means and what the other issue is, this is related to.
 [2008-12-05 09:13 UTC] pajoye@php.net
The bundled GD is the recommend version anyway. It has more bug fixes and features than almost all GD distributions out there (the worst is debian's gd which should not be used at all).

Functions like imagefilter, imagerotate are not available when an external GD is used.

php6 may support external GD but only a recent version and only when a minimum set of features are enabled.
 [2008-12-05 18:53 UTC] php-bugs-2008 at ryandesign dot com
Thanks for letting us know why specifically the bundled libgd is superior (the imagefilter and imagerotate functions). Given this, I will switch MacPorts php5 back to using the bundled libgd.

You must admit however there is room for confusion. The first sentence on the installation instructions [1] says "If you have the GD library (available at ? http://www.libgd.org/) you will also be able to create and manipulate images." And the libgd homepage in turn says "The library [...] is now maintained by Pierre-A. Joye under the umbrella of PHP.net." This gives the impression that the standalone libgd is being developed by the same people who develop PHP's bundled libgd. The note further down the installation instructions reads "Since PHP 4.3 there is a bundled version of the GD lib [which] should be used in preference to the external library since its codebase is better maintained and more stable." Because PHP 4.3 is so old, someone reading this note might well assume the information is outdated, and that since libgd is now under PHP.net's umbrella, the unique changes in PHP's bundled libgd are now in the standalone libgd as well.

php5 has supported standalone libgd, up to and including php 5.3.0 alpha 1. So it would be good if php 5.3.0 final did not break this. Or, if it is your intention to break this, then do so with a friendlier message in the configure phase and update the documentation.

[1] http://www.php.net/manual/en/image.setup.php
 [2009-03-27 18:03 UTC] tsteiner at nerdclub dot net
This is still an issue in 5.3.0RC1.  If building against an external version of GD is no longer supported, the configure script should probably be updated to throw an error or at least a warning should one try to do so.  Currently, the build just fails during "make" with the error:

ext/gd/gd.c:72:23: error: gdhelpers.h: No such file or directory

leaving the user with no idea what to do.
 [2009-03-27 18:50 UTC] tsteiner at nerdclub dot net
Here's a quick patch that removes support for building against an external libgd and replaces it with an error message.  It seems to work as intended but I am by no means experienced with the autoconf system.

--- php-5.3.0RC1.orig/ext/gd/config.m4       2009-01-14 13:05:59.000000000 -0600
+++ php-5.3.0RC1/ext/gd/config.m4   2009-03-27 13:42:01.071603975 -0500
@@ -262,7 +262,6 @@
 dnl
 
 if test "$PHP_GD" = "yes"; then
-  GD_MODULE_TYPE=builtin
   extra_sources="libgd/gd.c libgd/gd_gd.c libgd/gd_gd2.c libgd/gd_io.c libgd/gd_io_dp.c \
                  libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c libgd/gd_png.c libgd/gd_jpeg.c \
                  libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c libgd/gdfontmb.c libgd/gdfontl.c \
@@ -339,57 +338,7 @@
 else
 
  if test "$PHP_GD" != "no"; then
-  GD_MODULE_TYPE=external
-  extra_sources="gdcache.c"
-
-dnl Various checks for GD features
-  PHP_GD_ZLIB
-  PHP_GD_TTSTR
-  PHP_GD_JPEG
-  PHP_GD_PNG
-  PHP_GD_XPM
-  PHP_GD_FREETYPE2
-  PHP_GD_T1LIB
-
-dnl Header path
-  for i in include/gd1.3 include/gd include gd1.3 gd ""; do
-    test -f "$PHP_GD/$i/gd.h" && GD_INCLUDE="$PHP_GD/$i"
-  done
-
-dnl Library path
-  for i in $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do
-    test -f "$PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME" || test -f "$PHP_GD/$i/libgd.a" && GD_LIB="$PHP_GD/$i"
-  done
-
-  if test -n "$GD_INCLUDE" && test -n "$GD_LIB"; then
-    PHP_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB, GD_SHARED_LIBADD)
-    AC_DEFINE(HAVE_LIBGD,1,[ ])
-    PHP_GD_CHECK_VERSION
-  elif test -z "$GD_INCLUDE"; then
-    AC_MSG_ERROR([Unable to find gd.h anywhere under $PHP_GD])
-  else
-    AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $PHP_GD])
-  fi
-
-  PHP_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE)
-
-  dnl
-  dnl Check for gd 2.0.4 greater availability
-  dnl
-  old_CPPFLAGS=$CPPFLAGS
-  CPPFLAGS=-I$GD_INCLUDE
-  AC_TRY_COMPILE([
-#include <gd.h>
-#include <stdlib.h>
-  ], [
-gdIOCtx *ctx;
-ctx = malloc(sizeof(gdIOCtx));
-ctx->gd_free = 1;
-  ], [
-    AC_DEFINE(HAVE_LIBGD204, 1, [ ])
-  ])
-  CPPFLAGS=$old_CPPFLAGS
-
+  AC_MSG_ERROR([Building the GD extension against an external libgd is not supported.])
  fi
 fi
 
@@ -399,23 +348,13 @@
 if test "$PHP_GD" != "no"; then
   PHP_NEW_EXTENSION(gd, gd.c $extra_sources, $ext_shared,, \\$(GDLIB_CFLAGS))
 
-  if test "$GD_MODULE_TYPE" = "builtin"; then
-    GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
-    PHP_ADD_BUILD_DIR($ext_builddir/libgd)
-    GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
-
-    PHP_TEST_BUILD(foobar, [], [
-      AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
-    ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
-  else
-    GD_HEADER_DIRS="ext/gd/"
-    GDLIB_CFLAGS="-I$GD_INCLUDE $GDLIB_CFLAGS"
-    PHP_ADD_INCLUDE($GD_INCLUDE)
-
-    PHP_CHECK_LIBRARY(gd, gdImageCreate, [], [
-      AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
-    ], [ -L$GD_LIB $GD_SHARED_LIBADD ])
-  fi
+  GDLIB_CFLAGS="-I$ext_srcdir/libgd $GDLIB_CFLAGS"
+  PHP_ADD_BUILD_DIR($ext_builddir/libgd)
+  GD_HEADER_DIRS="ext/gd/ ext/gd/libgd/"
+
+  PHP_TEST_BUILD(foobar, [], [
+    AC_MSG_ERROR([GD build test failed. Please check the config.log for details.])
+  ], [ $GD_SHARED_LIBADD ], [char foobar () {}])
 
   PHP_INSTALL_HEADERS([$GD_HEADER_DIRS])
   PHP_SUBST(GDLIB_CFLAGS)
 [2009-04-07 09:27 UTC] pajoye@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-04-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-17 08:42 UTC] pajoye@php.net
Fixed in 5.3.0 and later.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC