469,647 Members | 1,745 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

Configuring PHP 5.2.3 with GD support for Mac OS X

pbmods
5,821 Expert 4TB
Configuring PHP 5.2.3 with GD support for Mac OS X

PHP 5.2.3 does not seem to want to configure with GD support on Mac OS X for some reason. When configuring, you may notice this error:

Expand|Select|Wrap|Line Numbers
  1. configure: error: GD build test failed. Please check the config.log for details.
Checking config.log yields the following:
Expand|Select|Wrap|Line Numbers
  1. configure:42434: gcc -o conftest -g -O2  -no-cpp-precomp  -L/usr/local/lib -L/usr/local/lib conftest.c  -L   -lfreetype -lpng -lz -ljpeg -lm  -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 1>&5
  2. /usr/bin/ld: -L: directory name missing
  3. collect2: ld returned 1 exit status
  4.  
Notice the '-L ' in the string above.

The easy solution is to remove that errant '-L', since it doesn't do anything (except crash the configure script, that is). But where is it?

Looking on line 42434 of the configure script doesn't look too helpful....
Expand|Select|Wrap|Line Numbers
  1. if { (eval echo configure:42434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  2. then
  3.  
Looks like the problem is in $ac_link, which is defined on line 2152:
Expand|Select|Wrap|Line Numbers
  1. ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
  2.  
Since the '-L ' showed up after 'conftest.c' in the ld arguments, we know the problem must be in $LIBS.

But where is $LIBS defined?

Moving backwards from line 42434, we encounter this definition on line 42415:
Expand|Select|Wrap|Line Numbers
  1.   LIBS=" -L$GD_LIB $GD_SHARED_LIBADD  $LIBS"
  2.  
If you were to echo $GD_LIB, you'd get an empty string. Bingo!

Simply remove that part of the string:
Expand|Select|Wrap|Line Numbers
  1.   LIBS=" $GD_SHARED_LIBADD  $LIBS"
  2.  
Then delete config.cache and reconfigure, and you're golden!
Jun 28 '07 #1
5 13277
Motoma
3,237 Expert 2GB
I think it's appalling that $GD_LIB, $GD_SHARED_LIBADD, and $LIBS are all empty, another alternative to the one you proposed would be to hunt down the appropriate locations and set them properly when you call your configure or make command.
Jul 10 '07 #2
mdarby
1
Dude, I owe you a beer or three.
Jul 16 '07 #3
pbmods
5,821 Expert 4TB
I think it's appalling that $GD_LIB, $GD_SHARED_LIBADD, and $LIBS are all empty, another alternative to the one you proposed would be to hunt down the appropriate locations and set them properly when you call your configure or make command.
Since PHP uses a bundled version of GD, there really aren't any additional library locations to search.
Jul 17 '07 #4
sojweb
1
You're a lifesaver; the fix works like a charm.
Aug 13 '07 #5
coolgames
169 100+
wow !

i;ve been wondering....
thankyou.
Oct 2 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Ed Stevens | last post: by
1 post views Thread by Ron Weldy | last post: by
reply views Thread by Jack Wu | last post: by
1 post views Thread by RoyScripts | last post: by
1 post views Thread by rada.lambretha | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.