Bug #66204 [Com]: disabling XPM support in GD still enables gdImageCreateFromXpm() for PHP
Edit report at https://bugs.php.net/bug.php?id=66204&edit=1
ID: 66204
Comment by: uncle dot ziba at gmail dot com
Reported by: rob dot de dot langhe at twistfare dot be
Summary: disabling XPM support in GD still enables
gdImageCreateFromXpm() for PHP
Status: Not a bug
Type: Bug
Package: GD related
Operating System: Solaris-10
PHP Version: 5.5.6
Block user comment: N
Private report: N
New Comment:
Ran into this as well with version 5.6.10 on AIX. I wonder if there is a more reliable way for the
configure script to determine if the GD library has xmp support.
workaround in the main/php_config.h comment out:
#define HAVE_GD_XPM 1
make clean; make
Previous Comments:
------------------------------------------------------------------------
[2015-06-20 00:27:50] iggyvolz at gmail dot com
This bug is still in PHP - it is impossible to install with GD without libXpm, as PHP will always
report that it is installed even if it is not. My workaround was to edit ext/gd/gd.c and remove all
code that depended on HAVE_GD_XPM.
------------------------------------------------------------------------
[2013-11-30 13:02:38] rob dot de dot langhe at twistfare dot be
If you consider this not to be a bug, where do you want me to report this (at least incorrect)
behaviour ?
------------------------------------------------------------------------
[2013-11-29 17:29:59] pajoye@php.net
right, but you get the error in userland too.
------------------------------------------------------------------------
[2013-11-29 16:08:43] rob dot de dot langhe at twistfare dot be
The "libgd" library will apparently always contain a function
"gdImageCreateFromXpm()", but which will return an error when it is called in case the
building of "libgd" was done with "--with-xpm=no" :
in ./src/gdxpm.c :
...
#ifndef HAVE_LIBXPM
BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm(char *filename)
{
(void)filename;
gd_error_ex(GD_ERROR, "libgd was not built with xpm support\n");
return NULL;
}
#else
...
So the check done by PHP with a linking of a test program to see if there is XPM support in the
"libgd" library, despite the fact that the 'configure' flags
"--without-xpm" or "--with-xpm-dir=no" were given, is incorrect. It will always
return success, because that function "gdImageCreateFromXpm()" will always be in the libgd
library file.
------------------------------------------------------------------------
[2013-11-29 15:33:36] rob dot de dot langhe at twistfare dot be
Description:
------------
We do not want to include X11 (XPM) support.
So we built the LIBGD library (version 2.1.0) with GCC (version 4.7.1) using both the flags
"--with-xpm=no --without-xpm"
However the generated library "libgd.so.3.0.0" still contains a function
"gdImageCreateFromXpm()" which is used by PHP to see if XPM is anyhow available in the
"libgd" library:
When building the PHP version 5.5.6 using the flag "--with-xpm-dir=no" gives the following
output from "configure" :
...
configure:37479: checking for the location of libXpm
configure:37494: result: no
...
configure:42617: checking for gdImageCreateFromXpm in -lgd
configure:42642: /our_base_dir/bin/gcc -o conftest -m32 -I/our_base_dir/include -fvisibility=hidden
-D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -L/our_base_dir/lib -lxml2 -m32
-R/usr/ucblib -L/usr/ucblib -R/our_base_dir/lib/gcc/sparc-sun-solaris2.10/4.7.1 -L/
our_base_dir/lib/gcc/sparc-sun-solaris2.10/4.7.1 -R/our_base_dir/lib -L/our_base_dir/lib conftest.c
-lgd -lgd -lpng -lz -lpng -lz -lz -lrt -lm -lnsl -lsocket -lgcc -lxml2 -lz -lm -lso
cket -lnsl -lxml2 -lz -lm -lsocket -lnsl >&5
configure:42642: $? = 0
configure:42651: result: yes
...
With the "conftest.c" file containing a call to that function
"gdImageCreateFromXpm()", to see if the compiler finds that function in the
"libgd.so.3.0.0" library, which it does despite that we disabled the support for XPM in
the building of LIBGD.
$ cat conftest.c
#ifdef __cplusplus
extern "C"
#endif
char gdImageCreateFromXpm ();
int
main ()
{
return gdImageCreateFromXpm ();
;
return 0;
}
After "configure" is done, the "config.status" contains the flag
D["HAVE_GD_XPM"]=" 1"
so that PHP will attempt to build with X11 support, and fails during compilation because we do not
(and don't want) have the X11 libraries installed:
$ make
...
/bin/bash /our_base_dir/src/php-5.5.6/libtool --silent --preserve-dup-deps --mode=compile
/our_base_dir/bin/gcc -I/our_base_dir/include -Iext/gd/ -I/our_base_dir/src/php-5.5.6/ext/gd/
-DPHP_ATOM_INC -I/our_base_dir/src/php-5.5.6/include -I/our_base_dir/src/php-5.5.6/main
-I/our_base_dir/src/php-5.5.6 -I/our_base_dir/src/php-5.5.6/ext/date/lib
-I/our_base_dir/src/php-5.5.6/ext/ereg/regex -I/usr/include/libxml2 -I/our_base_dir/include
-I/our_base_dir/src/php-5.5.6/ext/sqlite3/libsqlite -I/our_base_dir/src/php-5.5.6/TSRM
-I/our_base_dir/src/php-5.5.6/Zend -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS
-D_REENTRANT -m32 -I/our_base_dir/include -fvisibility=hidden -DZTS -c
/our_base_dir/src/php-5.5.6/ext/gd/gd.c -o ext/gd/gd.lo
/bin/bash /our_base_dir/src/php-5.5.6/libtool --silent --preserve-dup-deps --mode=compile
/our_base_dir/bin/gcc -I/our_base_dir/include -Iext/gd/ -I/our_base_dir/src/php-5.5.6/ext/gd/
-DPHP_ATOM_INC -I/our_base_dir/src/php-5.5.6/include -I/our_base_dir/src/php-5.5.6/main
-I/our_base_dir/src/php-5.5.6 -I/our_base_dir/src/php-5.5.6/ext/date/lib
-I/our_base_dir/src/php-5.5.6/ext/ereg/regex -I/usr/include/libxml2 -I/our_base_dir/include
-I/our_base_dir/src/php-5.5.6/ext/sqlite3/libsqlite -I/our_base_dir/src/php-5.5.6/TSRM
-I/our_base_dir/src/php-5.5.6/Zend -D_POSIX_PTHREAD_SEMANTICS -D_POSIX_PTHREAD_SEMANTICS
-D_REENTRANT -m32 -I/our_base_dir/include -fvisibility=hidden -DZTS -c
/our_base_dir/src/php-5.5.6/ext/gd/gd_compat.c -o ext/gd/gd_compat.lo
/our_base_dir/src/php-5.5.6/ext/gd/gd.c:57:22: fatal error: X11/xpm.h: No such file or directory
Any idea how we can really force the disabling of XPM support in the libgd library ?
Expected result:
----------------
A way to really disable the XPM support in the libgd library.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66204&edit=1
Thread (8 messages)