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

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.
  • Facebook
  • Twitter
  • del.icio.us
  • LinkedIn
  • DZone
  • Reddit
  • Digg
  • StumbleUpon
  • Sphinn
This entry was posted in php and tagged , , . Bookmark the permalink.

5 Responses to Compiling PHP With “--with-jpeg-dir” Not Working?

  1. Bakyt Niyazov says:

    You helped me a lot! Thank you!

    (was fighting with it last 1 hour)

  2. daeltar says:

    Thank you, that is plain crazy.

  3. Zakir Hemraj says:

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

  4. Thanks. Was having a hard time with this! Forgot make clean, duh!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">