[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: ld problem



Thanks Jan.

 I just installed latest Debian. Linker ld is not able to find libX11:
=20
damani@damani-pc:/tmp/binutils-2.15/ld$ ld -lX11
ld: cannot find -lX11
That's ok - ld only searches some standard directories for libraries,
and /usr/X11R6/lib isn't one of them. Here's a (probably non-represen-
tative) list of checked directories on my system (strace output, but you
can see the locations it tries):
open("/usr/bin/../lib/libX11.so", O_RDONLY) =3D -1 ENOENT
..... (similar lines omitted)
open("/usr/lib/libX11.a", O_RDONLY)     =3D -1 ENOENT
So, you'll have to specify -L/usr/X11R6/lib explicitly when linking
against X libraries.

I still need to understand the role of /etc/ld.so.cache then. From ldconfig man page:

"ldconfig creates the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib).
...
-p --print-cache
Print the lists of directories and candidate libraries stored in the current cache.
"

All these libs are present in /etc/ld.so.cache :
=20
damani@damani-pc:/tmp/binutils-2.15/ld$ ldconfig -p | grep libX11
        libX11.so.6 (libc6) =3D> /usr/X11R6/lib/libX11.so.6
        libX11.so (libc6) =3D> /usr/X11R6/lib/libX11.so

Thanks Jan. My bad with lproc. But there are other similar things:

damani@damani-pc:~$ ldconfig -p | grep libGL.so.1
        libGL.so.1 (libc6) => /usr/X11R6/lib/libGL.so.1
        libGL.so.1 (libc6) => /usr/lib/libGL.so.1
damani@damani-pc:~$ ld -lGL
ld: cannot find -lGL

Thanks,
Om



Reply to: