building GD/gcc linking..

Matthew Gillen me at mattgillen.net
Thu Jul 21 14:10:00 EDT 2005


Grant M. wrote:
> Ok, I was trying to build GD and it kept telling me libjpeg wasn't
> installed, so after some tracking, it comes down to this:
> ld says it can't find the library:
>    gcc ./test.c -o test -L/usr/lib -l jpeg
>    /usr/bin/ld: cannot find -ljpeg
> 
> I tried several variations of this:
>    gcc ./test.c -o test -L/usr/lib -l libjpeg
>    gcc ./test.c -o test -L/usr/lib -l libjpeg.so.62
>    gcc ./test.c -o test -L/usr/lib -l /usr/local/libjpeg.so.62
> 
> all with the same result.
> I then did this:
>    /sbin/ldconfig -v | grep -i jpeg
>         libimlib-jpeg.so -> libimlib-jpeg.so
>         libjpeg.so.62 -> libjpeg.so.62.0.0
> 
> Which I believe indicates that it should have found it.
> 
> Any suggestions?

The problem is with library versioning.  You have a version of the jpeg
library installed, but there is a convention with the linker that there
should exist (for initial linking purposes) a .so version (with no
numbers).  Redhat has taken the stance that since this symbolic link is
only needed for compilation, then it is part of the -devel package.  So,
the right solution to your problem is to install the -devel package
corresponding to the package containing the libjpeg library.  The
naughty thing you could do is just manually 'ln -s libjpeg.so.62 libjpeg.so'

Hope that helps.
--Matt



More information about the Discuss mailing list