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
Ralf