php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55224 make fails if configured with --with-gd=DIR
Submitted: 2011-07-18 04:36 UTC Modified: 2016-07-13 18:51 UTC
Votes:67
Avg. Score:4.3 ± 0.8
Reproduced:58 of 59 (98.3%)
Same Version:29 (50.0%)
Same OS:10 (17.2%)
From: manuel at bouza dot ch Assigned: cmb
Status: Closed Package: GD related
PHP Version: 5.4 OS: *
Private report: No CVE-ID:
 [2011-07-18 04:36 UTC] manuel at bouza dot ch
Description:
------------
If PHP is configured with --with-gd for compilation, make fails and aborts with an 
error.


Test script:
---------------
On my MAC OSX 10.6.8, I configured PHP as follows for compilation:

> ./configure \
--prefix=/opt/local/php-5.4-dev \
--with-config-file-path=/opt/local/php-5.4-dev/etc \
--enable-fpm \
--with-fpm-user=_www \
--with-fpm-group=_www \
--enable-sockets \
--enable-mbstring \
--enable-pcntl \
--enable-soap \
--enable-sockets \
--enable-zip \
--with-zlib \
--with-curl \
--with-gd=/opt/local \
--with-jpeg-dir=/opt/local \
--with-png-dir=/opt/local \
--with-zlib-dir \
--with-gettext=/opt/local \
--with-mcrypt=/opt/local \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pdo-sqlite \
--with-tidy \
--with-pear \
--with-iconv

> make

Produces error as stated in actual result (see below).


Expected result:
----------------
I expect make to complete successfully when --with-gd is specified for 
configuration.

Actual result:
--------------
Make fails and aborts with the following error: 

/bin/sh /Users/manuel.bouza/tmp/php-5.4-dev/libtool --silent --preserve-dup-deps 
--mode=compile cc -I/opt/local/include -Iext/gd/ -I/Users/manuel.bouza/tmp/php-
5.4-dev/ext/gd/ -DPHP_ATOM_INC -I/Users/manuel.bouza/tmp/php-5.4-dev/include -
I/Users/manuel.bouza/tmp/php-5.4-dev/main -I/Users/manuel.bouza/tmp/php-5.4-dev 
-I/Users/manuel.bouza/tmp/php-5.4-dev/ext/date/lib -
I/Users/manuel.bouza/tmp/php-5.4-dev/ext/ereg/regex -I/usr/include/libxml2 -
I/opt/local/include -I/usr/local/include -I/Users/manuel.bouza/tmp/php-5.4-
dev/ext/mbstring/oniguruma -I/Users/manuel.bouza/tmp/php-5.4-
dev/ext/mbstring/libmbfl -I/Users/manuel.bouza/tmp/php-5.4-
dev/ext/mbstring/libmbfl/mbfl -I/Users/manuel.bouza/tmp/php-5.4-
dev/ext/sqlite3/libsqlite -I/usr/include/tidy -I/Users/manuel.bouza/tmp/php-5.4-
dev/TSRM -I/Users/manuel.bouza/tmp/php-5.4-dev/Zend  -no-cpp-precomp  -
I/usr/local/include -g -O2 -fvisibility=hidden -DZEND_SIGNALS  -c 
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd.c -o ext/gd/gd.lo 
In file included from /Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd.c:103:
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c: In function 
‘_php_image_stream_putc’:
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:51: error: ‘struct gdIOCtx’ 
has no member named ‘data’
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c: In function 
‘_php_image_stream_putbuf’:
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:58: error: ‘struct gdIOCtx’ 
has no member named ‘data’
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c: In function 
‘_php_image_stream_ctxfree’:
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:67: error: ‘struct gdIOCtx’ 
has no member named ‘data’
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:68: error: ‘struct gdIOCtx’ 
has no member named ‘data’
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:69: error: ‘struct gdIOCtx’ 
has no member named ‘data’
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c: In function 
‘_php_image_output_ctx’:
/Users/manuel.bouza/tmp/php-5.4-dev/ext/gd/gd_ctx.c:153: error: ‘gdIOCtx’ has no 
member named ‘data’
make: *** [ext/gd/gd.lo] Error 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-18 22:26 UTC] aharvey@php.net
-Status: Open +Status: Feedback -Package: Compile Failure +Package: GD related
 [2011-07-18 22:26 UTC] aharvey@php.net
What version of libgd do you have installed in /opt/local?
 [2011-07-19 02:53 UTC] manuel at bouza dot ch
-Status: Feedback +Status: Open
 [2011-07-19 02:53 UTC] manuel at bouza dot ch
It's libgd version 2.0.35.
 [2011-07-22 09:14 UTC] manuel at bouza dot ch
-Summary: make fails if configured with --with-gd +Summary: make fails if configured with --with-gd=DIR
 [2011-07-22 09:14 UTC] manuel at bouza dot ch
make does not fail if configured with --with-gd (using native library)
 [2012-03-02 09:54 UTC] cornelius dot howl at gmail dot com
Same here. I got this in clang compiler:  (PHP5.4 on Mac OS 10.8)

GD version: 

#define GD_VERSION_STRING "2.0.35"


ext/gd//gd_ctx.c:51:43: error: no member named 'data' in 'struct gdIOCtx'
        php_stream * stream = (php_stream *)ctx->data;
                                            ~~~  ^
ext/gd//gd_ctx.c:58:43: error: no member named 'data' in 'struct gdIOCtx'
        php_stream * stream = (php_stream *)ctx->data;
                                            ~~~  ^
ext/gd//gd_ctx.c:67:10: error: no member named 'data' in 'struct gdIOCtx'
        if(ctx->data) {
           ~~~  ^
ext/gd//gd_ctx.c:68:40: error: no member named 'data' in 'struct gdIOCtx'
                php_stream_close((php_stream *) ctx->data);
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/Users/c9s/.phpbrew/build/php-5.4.0/main/php_streams.h:287:52: note: expanded from:
#define php_stream_close(stream)        _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC)
                                                          ^
In file included from /Users/c9s/.phpbrew/build/php-5.4.0/ext/gd/gd.c:103:
ext/gd//gd_ctx.c:69:8: error: no member named 'data' in 'struct gdIOCtx'
                ctx->data = NULL;
                ~~~  ^
ext/gd//gd_ctx.c:153:8: error: no member named 'data' in 'struct gdIOCtx'
                ctx->data = (void *)stream;
                ~~~  ^
 [2012-03-02 10:00 UTC] cornelius dot howl at gmail dot com
I think the problem is caused from:

gd.c:  typedef FILE gdIOCtx;

I commented this line, and compiler works. :-)
 [2012-04-11 13:32 UTC] hengjie at gmail dot com
This also happens on CentOS5 when I'm using --with-gd=/usr flag. /usr should be 
where the native GD library is installed.

This information is to expand the scope of this problem.
 [2012-04-11 22:42 UTC] nicek at hotmail dot com
I'm having the same issue with Solaris 10 U9 09/10. I haven't found a work-around either.

php-5.4.0
gd-2.0.35

Nic

./configure --prefix=/usr/local-build --with-apxs2=/usr/local-build/bin/apxs --enable-libgcc --with-libxml-dir=/usr/local-build --with-openssl=/usr/local-build --with-zlib=/usr/local-build --with-bz2=/usr/lib --enable-calendar --with-curl=/usr/local-build --enable-exif -enable-ftp --with-mysql=/usr/local-build --with-mysqli=/usr/local-build/bin/mysql_config --with-pdo-mysql=/usr/local-build --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-gd=/usr/local-build --with-libxml-dir=/usr/local-build --with-jpeg-dir=/usr/local-build --with-png-dir=/usr/local-build --with-zlib-dir=/usr/local-build --with-xpm-dir=/usr/local-build --with-freetype-dir=/usr/local-build

/bin/bash /home/builder/packages/php-5.4.0/libtool --silent --preserve-dup-deps --mode=compile gcc -I/usr/local-build/include -Iext/gd/ -I/home/builder/packages/php-5.4.0/ext/gd/ -DPHP_ATOM_INC -I/home/builder/packages/php-5.4.0/include -I/home/builder/packages/php-5.4.0/main -I/home/builder/packages/php-5.4.0 -I/home/builder/packages/php-5.4.0/ext/date/lib -I/home/builder/packages/php-5.4.0/ext/ereg/regex -I/usr/local-build/include/libxml2 -I/usr/local-build/include -I/usr/local-build/include/freetype2 -I/home/builder/packages/php-5.4.0/ext/sqlite3/libsqlite -I/home/builder/packages/php-5.4.0/TSRM -I/home/builder/packages/php-5.4.0/Zend  -D_POSIX_PTHREAD_SEMANTICS  -I/usr/include -g -O2  -c /home/builder/packages/php-5.4.0/ext/gd/gd.c -o ext/gd/gd.lo
In file included from /home/builder/packages/php-5.4.0/ext/gd/gd.c:103:
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c: In function `_php_image_stream_putc':
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:51: error: structure has no member named `data'
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c: In function `_php_image_stream_putbuf':
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:58: error: structure has no member named `data'
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c: In function `_php_image_stream_ctxfree':
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:67: error: structure has no member named `data'
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:68: error: structure has no member named `data'
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:69: error: structure has no member named `data'
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c: In function `_php_image_output_ctx':
/home/builder/packages/php-5.4.0/ext/gd/gd_ctx.c:153: error: structure has no member named `data'
*** Error code 1
make: Fatal error: Command failed for target `ext/gd/gd.lo'
 [2012-05-13 05:24 UTC] elifan2007 at ya dot ru
freebsd 9.0
The same with any php-5.4.x for now (--with-gd=/usr/local).
gd-2.0.35

Wasn't corrected in php-5.4.3, so using 5.3.13 instead, thanx

/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_putc':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:51: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_putbuf':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:58: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_ctxfree':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:67: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:68: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:69: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_output_ctx':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:153: error: 'gdIOCtx' has no member named 'data'
*** Error code 1

Stop in /home/src/php-5.4.3.
 [2012-05-27 05:46 UTC] oniuda at oni dot gr dot jp
On FreeBSD 9.0-STABLE,I tried to make php-5.4.3 --with-dg=/usr/local.
I installed gd from /usr/ports/graphics/gd (gd-2.0.35).

---
In file included from /usr/local/src/php-5.4.3/ext/gd/gd.c:103:
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_putc':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:51: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_putbuf':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:58: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_stream_ctxfree':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:67: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:68: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:69: error: 'struct gdIOCtx' has no member named 'data'
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c: In function '_php_image_output_ctx':
/usr/local/src/php-5.4.3/ext/gd/gd_ctx.c:153: error: 'gdIOCtx' has no member named 'data'
gmake: *** [ext/gd/gd.lo] Error 1
---
I made php-5.3.13 with same configure options.So I investigated the cause.
In php-5.4.3/ext/gd/libgd/gd_io.h 
typedef struct gdIOCtx {
        int     (*getC)(struct gdIOCtx*);
        int     (*getBuf)(struct gdIOCtx*, void*, int);

        void    (*putC)(struct gdIOCtx*, int);
        int     (*putBuf)(struct gdIOCtx*, const void*, int);

        int     (*seek)(struct gdIOCtx*, const int);
        long    (*tell)(struct gdIOCtx*);

        void    (*gd_free)(struct gdIOCtx*);

        void    *data;
} gdIOCtx;
But in /usr/local/include/gd_io.h
typedef struct gdIOCtx
{
  int (*getC) (struct gdIOCtx *);
  int (*getBuf) (struct gdIOCtx *, void *, int);

  void (*putC) (struct gdIOCtx *, int);
  int (*putBuf) (struct gdIOCtx *, const void *, int);

  /* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
  int (*seek) (struct gdIOCtx *, const int);

  long (*tell) (struct gdIOCtx *);

  void (*gd_free) (struct gdIOCtx *);

}
gdIOCtx;
These isn't void    *data;.In some gd versions (ex:gd-2.0.36RC,gd-2.0.34)
there ins't void    *data;.

I think that php-5.4.X was required extended gd library.
Shuold we configure --with-gd not --with-gd=DIR?
 [2013-11-15 02:38 UTC] addurl at croler dot net
Same result with php-5.4.21 on 64 bit CentOS 5. I usually compile php with --with-gd=/usr because without it I get undefined reference errors, but now I can't.
 [2016-07-13 18:32 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Operating System: MAC OSX 10.6.8 +Operating System: * -PHP Version: 5.4SVN-2011-07-18 (SVN) +PHP Version: 5.4 -Assigned To: +Assigned To: cmb
 [2016-07-13 18:32 UTC] cmb@php.net
As of PHP 5.4 ext/gd requires libgd-2.1.0 at least. If your distro
ships older libgd versions, either build it yourself or use PHP's
bundled libgd.
 [2016-07-13 18:51 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=339659
Log: Fix #55224: make fails if configured with --with-gd=DIR

Additionally, we get rid of the out-dated statement that PHP's bundled libgd
should generally be preferred.
 [2016-07-13 18:51 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat May 27 19:01:36 2017 UTC