# Building ext/gd via phpize and using the bundled libgd

- Thread: https://externals.io/message/19454
- Original archive: https://news-web.php.net/php.internals/19454
- Started by Brian J. France on 2005-10-06T18:34:54+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #19454 — Brian J. France — 2005-10-06T18:34:54+00:00

URL: https://externals.io/message/19454#19454

The following patch is need if phpize is going to be used to build 
ext/gd with the bundled libgd library.

Otherwise HAVE_GD_BUNDLED will not be set for the bundled lib so it 
will not build with the php_gd_ prefix, but the extension will have 
HAVE_GD_BUNDLED defined and expecting the php_gd_ prefix which will 
cause undefined symbol errors on loading.

Thanks,

Brian

Index: gd.h
===================================================================
RCS file: /repository/php-src/ext/gd/libgd/gd.h,v
retrieving revision 1.26
diff -u -p -b -B -r1.26 gd.h
--- gd.h        27 Mar 2005 23:43:52 -0000      1.26
+++ gd.h        6 Oct 2005 18:28:10 -0000
@@ -5,6 +5,10 @@
  extern "C" {
  #endif

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
  #include "php_compat.h"

  #ifndef WIN32

---

## #19457 — Brian J. France — 2005-10-06T18:42:49+00:00

URL: https://externals.io/message/19454#19457 · In reply to: #19454

Need to patch a few more files:


> The following patch is need if phpize is going to be used to build 
> ext/gd with the bundled libgd library.
>
> Otherwise HAVE_GD_BUNDLED will not be set for the bundled lib so it 
> will not build with the php_gd_ prefix, but the extension will have 
> HAVE_GD_BUNDLED defined and expecting the php_gd_ prefix which will 
> cause undefined symbol errors on loading.
>
> Thanks,
>
> Brian

Index: gd.h
===================================================================
RCS file: /repository/php-src/ext/gd/libgd/gd.h,v
retrieving revision 1.26
diff -u -p -r1.26 gd.h
--- gd.h        27 Mar 2005 23:43:52 -0000      1.26
+++ gd.h        6 Oct 2005 18:42:09 -0000
@@ -5,6 +5,10 @@
  extern "C" {
  #endif

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
  #include "php_compat.h"

  #ifndef WIN32
Index: gdtables.c
===================================================================
RCS file: /repository/php-src/ext/gd/libgd/gdtables.c,v
retrieving revision 1.2
diff -u -p -r1.2 gdtables.c
--- gdtables.c  31 Aug 2004 16:41:29 -0000      1.2
+++ gdtables.c  6 Oct 2005 18:42:09 -0000
@@ -1,4 +1,8 @@

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
  #include "php_compat.h"

  int gdCosT[] =
Index: wbmp.h
===================================================================
RCS file: /repository/php-src/ext/gd/libgd/wbmp.h,v
retrieving revision 1.3
diff -u -p -r1.3 wbmp.h
--- wbmp.h      31 Aug 2004 16:41:29 -0000      1.3
+++ wbmp.h      6 Oct 2005 18:42:10 -0000
@@ -12,6 +12,10 @@
  #ifndef __WBMP_H
  #define __WBMP_H       1

+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
  #include "php_compat.h"

  /* WBMP struct
