Home > PHP > Compiling PHP With “–with-jpeg-dir” Not Working?

Compiling PHP With “–with-jpeg-dir” Not Working?

April 10th, 2009

Had this strange issue a couple of days ago, where the following compile command didn’t give me the expected results (ability to use imagecreatefromjpeg() function). 

./configure --with-gd --with-jpeg-dir=/usr/lib
make
make test

The “make test” yielded the following results.

SKIP gif –> jpeg conversion test [ext/gd/tests/gif2jpg.phpt] reason: jpeg support unavailable
SKIP jpeg <–> png conversion test [ext/gd/tests/jpeg2png.phpt] reason: jpeg support unavailable
SKIP jpeg <–> gd1/gd2 conversion test [ext/gd/tests/jpg2gd.phpt] reason: jpeg support unavailable

Not exactly what I expected, because the libjpeg library existed in /usr/lib/libjpeg.so. Here’s what managed to fix it, running a “make clean” first, and changing the order of the “–with-gd” and “–with-jpeg-dir” parameters.

make clean
./configure --with-jpeg-dir=/usr/lib --with-gd
make
make test

And a make test now passes on the jpeg!

PASS gif –> jpeg conversion test [ext/gd/tests/gif2jpg.phpt]
PASS jpeg <–> png conversion test [ext/gd/tests/jpeg2png.phpt]
PASS jpeg <–> gd1/gd2 conversion test [ext/gd/tests/jpg2gd.phpt]

Tricky bugger this was …

Spread the word
If you liked the content of this article, please vote for it on the following websites - thanks.
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • StumbleUpon
  • Sphinn
  • Facebook
  • Live
  • Mixx
  • Technorati
  • TwitThis

Matti PHP , , , ,

  1. Bakyt Niyazov
    April 20th, 2009 at 17:25 | #1

    You helped me a lot! Thank you!

    (was fighting with it last 1 hour)

  2. August 15th, 2009 at 16:51 | #2

    Thank you, that is plain crazy.

  3. September 15th, 2009 at 20:40 | #3

    Amazing. This was driving me crazy. Why the hell does the order of the includes matter? grrr.

  4. Matteo
    January 26th, 2010 at 18:02 | #4

    thank you!

  1. No trackbacks yet.