Req #66716 [NEW]: config without XPM fails
| From: | rob dot de dot langhe at twistfare dot be | Date: | Fri, 14 Feb 2014 20:52:16 +0000 |
| Subject: | Req #66716 [NEW]: config without XPM fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-184300@lists.php.net to get a copy of this message | ||
From: rob dot de dot langhe at twistfare dot be
Operating system: Solaris-10
PHP version: 5.5.9
Package: Compile Failure
Bug Type: Feature/Change Request
Bug description:config without XPM fails
Description:
------------
previously filed "https://bugs.php.net/bug.php?id=66204",
but that was
rejected as "not a bug"...
However, there is no way currently to build PHP with libgd, but without
XPM. We don't want XPM, some suggested on the web to install XPM so that
they could succeed building PHP.
Therefor I file this 'change request':
1) when "libgd" (version 2.1.0) is 'configure'd with "--without-xpm",
it
will include anyhow a function "gdImageCreateFromXpm ()" from file
'src/gdxpm.c' with
#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
#include <X11/xpm.h>
...
2) when "php" (version 5.5.9) is 'configure'd with "--with-xpm-dir=no"
then it runs as follows:
...
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:
...
/bin/bash /our_base_dir/php-5.5.9/libtool --silent --preserve-dup-deps
--mode=link /our_base_dir/bin/gcc ... -o sapi/cli/php
Undefined first referenced
symbol in file
XpmLibraryVersion ext/gd/.libs/gd.o
ld: fatal: Symbol referencing errors. No output written to sapi/cli/php
collect2: error: ld returned 1 exit status
make[2]: *** [sapi/cli/php] Error 1
This is because in "ext/gd/gd.c" the code will call XpmLibraryVersion()
when the flag "HAVE_GD_XPM" has value '1' :
...
#if defined(HAVE_GD_XPM)
php_info_print_table_row(2, "XPM Support", "enabled");
{
char tmp[12];
snprintf(tmp, sizeof(tmp), "%d", XpmLibraryVersion());
php_info_print_table_row(2, "libXpm Version", tmp);
}
#endif
...
Conclusion:
the PHP configure script is not checking correctly if the libgd contains
XPM or not: libgd will always contain that function
gdImageCreateFromXpm(), but that function will just return a different
value depending on with- or without-XPM was specified.
PHP configure script should therefor test on the return value of that
function gdImageCreateFromXpm(), not just if the test program can be
linked correctly with the libgd library.
A fix can be this: modify the line in 'configure' such that it does not
only check if that function gdImageCreateFromXpm() can be found in the
libgd library (because it always will be there anyhow) but call it and
check if it returns NULL indicating that there is no XPM support in the
libgd :
in 'configure':
replace this:
return gdImageCreateFromXpm ();
by this:
if(gdImageCreateFromXpm()!=NULL){return 1;}else {return 0;}
With this change, PHP builds just fine on Solaris-10, using GCC, and
libgd (v2.1.0) but without any X11/XPM installed !
--
Edit bug report at https://bugs.php.net/bug.php?id=66716&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66716&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66716&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66716&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66716&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66716&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66716&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66716&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66716&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66716&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66716&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66716&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66716&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66716&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66716&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66716&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66716&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66716&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66716&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66716&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66716&r=mysqlcfg