On Thu, 2011-12-15 at 09:24 +0100, Ralf Corsepius wrote:
On 12/15/2011 09:06 AM, Jonathan Ryshpan wrote:
> A build is failing with the error cannot find<library> for libraries
> that are, in fact present on the system.
>
> I made a very simple test bed, consisting of the empty file conftest.c,
> which I attempt to compile and link with various libraries. All the
> libraries are in /usr/lib64. Sometimes the compilation fails with
> undefined reference to `main'
> which is what I would expect, but often it fails with
> cannot find -l<whatever>
> I have no idea what's happening. Can anyone explain?
You likely don't have the *-devel packages installed, which correspond
to the libraries you want to link against.
> Here's an example of what's going on. This is a listing of some files
> in /usr/lib64:
...
> lrwxrwxrwx. 1 root root 14 Nov 9 08:14 libgd.so.2 ->
libgd.so.2.0.0*
> -rwxr-xr-x. 1 root root 278048 Oct 26 20:15 libgd.so.2.0.0*
... These are the run-time libraries ...
> And here's a attempt to compile the dummy linking to them:
...
> 1034 wview-5.19.0 $ gcc -o conftest -g -O2 conftest.c -lgd
> /usr/bin/ld: cannot find -lgd
> collect2: ld returned 1 exit status
Here, ld is looking for "libgd.so".
=> You want to install the package which provides /usr/lib64/libgd.so
# repoquery -qf /usr/lib64/libgd.so
gd-devel-0:2.0.35-13.fc16.x86_64
It appears to be just as you write. This raises some further questions:
Is there any way to tell when a development library is installed on the
system? Am I correct in assuming that if <mumble>.so is in the library,
the development library is installed? Is there any convenient way to
install all the *-devel packages matching libraries on the system, or do
I just have to install them one by one as links fail?
Sorry for the extremely late reply. I have been away from my computer
for the last few weeks.
Thanks - jon