# compiling php libjpeg error



## lethe (Jul 12, 2002)

I m installing PHP with support for a GD graphics library (following instructions i got here at webmonkey)

i successfully installed all the prerequisites, libjpeg, libpng, libgd, etc.. but when it came time to install PHP, the configure script failed. i told it this:


```
./configure --with-gd=/sw/lib --with-jpeg-dir=/sw/lib --with-zlib-dir=/sw/lib
```

and it told me this:


```
checking for the location of libjpeg... yes
configure: error: libjpeg.(a|so) not found.
```

incidentally, this file does indeed exist here: /sw/lib/libjpeg.a


```
% ls /sw/lib/libjpeg.*
/sw/lib/libjpeg.62.0.0.dylib       /sw/lib/libjpeg.a                  /sw/lib/libjpeg.la
/sw/lib/libjpeg.62.dylib           /sw/lib/libjpeg.dylib
```


```
% fink list | grep jpeg
 i  libjpeg         6b-5        JPEG image format handling library
 i  libjpeg-bin     6b-5        JPEG image format handling library
 i  libjpeg-shlibs  6b-5        JPEG image format handling library
```

so why would libjpeg not be found? thanks for any help.


----------



## howardm4 (Jul 12, 2002)

from the PHP page:

 In order to read and write images in jpeg format, you will need to obtain and install jpeg-6b (available at ftp://ftp.uu.net/graphics/jpeg/), and then recompile GD to make use of jpeg-6b. You will also have to compile PHP with --with-jpeg-dir=/path/to/jpeg-6b. 

Basically, the 'jpeg-dir' is the root
of the jpeg 6b directory and not
necessarily where you installed the .a

My hunch is that the configure
script is looking for
<jpeg-dir>/lib/libjpeg.a

You'll need to either fake it, symlink
it or so.  check the config.log file for
more detail.


----------



## nesh (Mar 15, 2009)

Here is line which compiles php for me (fink) and *replacing* built in PHP


```
CFLAGS="-arch i386 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -g -Os -pipe" CXXFLAGS="-arch i386 -g -Os -pipe" LDFLAGS="-arch i386 -bind_at_load" ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --sysconfdir=/private/etc --enable-cli --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-ldap=/usr --with-kerberos=/usr --with-mime-magic=/etc/apache2/magic --with-zlib-dir=/usr --with-xmlrpc --with-xsl=/usr --without-iconv --with-gd --with-png-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --enable-exif --enable-pdo --with-jpeg-dir=/sw --with-freetype-dir=/sw --with-t1lib=/sw --with-pgsql=/sw --with-pdo-pgsql=/sw --with-curl=/sw/lib
```


----------

