PHP 4.0 Bug #8296: (with fix) empty library reference after ./configure
| From: | chrismcc+phpbug at pricegrabber dot com | Date: | Sat, 16 Dec 2000 17:37:33 +0000 |
| Subject: | PHP 4.0 Bug #8296: (with fix) empty library reference after ./configure | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41600@lists.php.net to get a copy of this message | ||
From: chrismcc+phpbug@pricegrabber.com
Operating system: Linux ( Redhat 6.x)
PHP version: 4.0.3pl1
PHP Bug Type: Compile Failure
Bug description: (with fix) empty library reference after ./configure
Using the php rpm from RH7 and recomliling on RH6.x produces
the following configure error
checking whether to include GNU gettext support... yes
checking for bindtextdomain in -lintl... no
checking for bindtextdomain in -lc... no
configure: error: Unable to find required gettext library
Where gettext IS there.
./configure ... --with-db2 and --with-db3 ... is used, but
db2 and db3 are not installed on the system
earlier in configure output
...
checking for db_create in -ldb... no
checking for db_create in -ldb-3... no
...
They are not found, But -l gets added the $LIBS
After much testing this is a fix.
--- aclocal.m4.pricegrabber Fri Dec 15 15:48:32 2000
+++ aclocal.m4 Fri Dec 15 15:47:56 2000
@@ -557,7 +557,7 @@
dnl
AC_DEFUN(AC_ADD_LIBRARY,[
case "$1" in
- c|c_r|pthread*) ;;
+ c|c_r|pthread*|'') ;;
*)
ifelse($3,,[
PHP_X_ADD_LIBRARY($1,$2,LIBS)
What happens is the case statment will fall through if the
tests are false. IT falls through with an empty $THIS_LIBS
variable
--from configure
case "$THIS_LIBS" in
c|c_r|pthread*) ;;
*)
LIBS="-l$THIS_LIBS $LIBS"
;;
esac
---end from
if LIBS=-lfoo -lbar
when $THIS_LIBS is empty you end up with
LIBS="-l -lfoo -lbar"
the next compile test tries to use these libraries
i.e.
configure:16753: checking for bindtextdomain in -lc
configure:16772: gcc -o conftest -O2 -march=i686 -fPIC
-L/usr/lib conftest.c -lc -lttf -ljpeg -lgd -l -ldb -lgdbm
-lresolv -lm -ldl -lcrypt -lnsl -lttf -lpng -ljpeg -lz
-lresolv -L/usr/lib -ljpeg 1>&5
/usr/bin/ld: cannot open -l-ldb: No such file or directory
-lgd -l -ldb -lgdbm
ends up
-lgd -l-ldb -lgdbm
The solution is for the case statement to handle a NULL or
empty case
case ...
c|c_r|pthread*|'') ;;
This IMHO, is a nasty bug and took me several hours to find.
p.s. I like getting my name in READMEs and CHANGELOGS
:)
--
Edit Bug report at: http://bugs.php.net/?id=8296&edit=1