Configuring PHP 5.2.3 with GD support for Mac OS X

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    Configuring PHP 5.2.3 with GD support for Mac OS X

    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:

    Code:
    configure: error: GD build test failed. Please check the config.log for details.
    Checking config.log yields the following:
    Code:
    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
    /usr/bin/ld: -L: directory name missing
    collect2: ld returned 1 exit status
    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....
    Code:
    if { (eval echo configure:42434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    then
    Looks like the problem is in $ac_link, which is defined on line 2152:
    Code:
    ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
    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:
    Code:
      LIBS=" -L$GD_LIB $GD_SHARED_LIBADD  $LIBS"
    If you were to echo $GD_LIB, you'd get an empty string. Bingo!

    Simply remove that part of the string:
    Code:
      LIBS=" $GD_SHARED_LIBADD  $LIBS"
    Then delete config.cache and reconfigure, and you're golden!
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    I think it's appalling that $GD_LIB, $GD_SHARED_LIBA DD, 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.

    Comment

    • mdarby
      New Member
      • Jul 2007
      • 1

      #3
      Dude, I owe you a beer or three.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Originally posted by Motoma
        I think it's appalling that $GD_LIB, $GD_SHARED_LIBA DD, 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.

        Comment

        • sojweb
          New Member
          • Aug 2007
          • 1

          #5
          You're a lifesaver; the fix works like a charm.

          Comment

          • coolgames
            New Member
            • Oct 2007
            • 168

            #6
            wow !

            i;ve been wondering....
            thankyou.

            Comment

            Working...