Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 30263 - ld doesn't find libraries
Summary: ld doesn't find libraries
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High blocker (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-03 11:30 UTC by Tomasz Olszewski
Modified: 2003-11-29 14:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Olszewski 2003-10-03 11:30:06 UTC
After updating my Gentoo to the most recent (stable) version, ld or ldconfig
became broken. For the first time I've seen it yet during (still unfinished due
to this bug) 'emerge -U world'. Some ebuild failed to build (I don't remember
what but it doesn't matter), because ld couldn't find -lXpm. The Xpm library
resides in /usr/X11R6/lib and I've got this path in my /etc/ld.so.conf. I've
tried reemerging xfree (my first guess was that libXpm was somehow broken),
binutils, glibc & gcc, but it didn't make any difference (of course I've tried
running ldconfig for several times). After deeper investigation I found that ld
is unable to find any library from /usr/X11R6/lib. That's not all! Here is my
/etc/ld.so.conf:

# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/usr/local/lib
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3
/opt/intel/compiler70/ia32/lib
/usr/lib/opengl/nvidia/lib
/usr/lib/mozilla
/usr/X11R6/lib
/opt/blackdown-jdk-1.4.1/jre/lib/i386/
/opt/blackdown-jdk-1.4.1/jre/lib/i386/native_threads/
/usr/qt/3/lib
/usr/games/lib
/usr/lib/fltk-1.1

It looks like ld doesn't see any libs from any path above starting from
/usr/lib/mozilla. The last thing is that it works perfectly when I'll pass those
paths explicitly via -L switch. This is why I am not sure if it's a problem
directly with ld or rather ldconfig.

Reproducible: Always
Steps to Reproduce:
1. Write a sample C program (like "int main() {return 0;}") -- let's call it
sample.c.
2. Try to compile it with 'gcc -o sample sample.c -lX11' (or any different lib
as described above, like -lqt org -lXpm).

Actual Results:  
tomek@dioptria tomek $ gcc -o sample sample.c -lX11
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/../../../../i686-pc-linux-gnu/bin/ld:
cannot find -lX11
collect2: ld returned 1 exit status


Expected Results:  
Link the needed library.

binutils: 2.14.90.0.6-r2
gcc: 3.2.3-r1
glibc: 2.3.2-r1

Here is output from emerge info:

tomek@dioptria tomek $ emerge info
Portage 2.0.49-r3 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1, 2.4.20-gentoo-r5)
=================================================================
System uname: 2.4.20-gentoo-r5 i686 AMD Duron(tm) Processor
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon -Os -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/confi
                    
g /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb /usr/share/texmf/tex/generic/co
                    
nfig/ /usr/share/texmf/tex/platex/config/"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=athlon -Os -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache autoaddcvs sandbox userpriv usersandbox fixpackages"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror http:/
                    
/ftp.belnet.be/mirror/rsync.gentoo.org/gentoo http://gentoo.oregonstate.edu http
                    
://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 oss apm avi crypt cups encode foomaticdb gif jpeg libg++ mad mikmod mmx
                    
 mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib alsa gdb
                    
m berkdb slang readline tetex bonobo ggi tcltk java guile X sdl gpm tcpd pam lib
                    
www ssl perl python imlib oggvorbis gtk qt motif opengl mozilla cdr scanner 3dno
                    
w aalib acpi acpi4linux cscope curl dga doc etwin faad fbcon gb gd gtk2 imagemag
                    
ick javascript jikes lcms maildir mbox mcal objc odbc plotutils sse tiff vim-wit
                    
h-x wmf Xaw3d xface xml -arts -kde -gnome -svga -esd"
Comment 1 Daniel Seyffer 2003-10-23 05:17:28 UTC
Hello,

Seems I am having the same bug here. 
e.g. while trying to "emerge -u kde" I always get similar ld messages for
various packages. [1]
 
--- snip from kdeaddons [...] ---
/bin/sh ../../libtool --silent --mode=link --tag=CXX g++  -Wnon-virtual-dtor
-Wno-long-long -Wundef -Wall -pedantic -W -Wpointer-arith -Wwrite-strings
-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2 -march=pentium3
-O2 -pipe -fomit-frame-pointer -fno-exceptions -fno-check-new -DQT_CLEAN_NAMESPACE
-DQT_NO_COMPAT -DQT_NO_ASCII_CAST    -o noatunmadness.la.closure noatunmadness_la_closure.lo
-L/usr/X11R6/lib -L/usr/qt/3/lib -L/usr/kde/3.1/lib  -module -avoid-version
-no-undefined `/usr/bin/sdl-config --libs` madness.lo -lkio -lnoatun -lm
libtool: link: cannot find the library `'
make[3]: *** [noatunmadness.la.closure] Fehler 1
make[3]: Leaving directory
`/var/tmp/portage/kdeaddons-3.1.4/work/kdeaddons-3.1.4/noatun-plugins/noatunmadness'
--- [...] ---

emerge info:
=============

Portage 2.0.49-r13 (default-x86-1.4, gcc-3.3.1, glibc-2.3.2-r6,
2.6.0-test8-mm1)=================================================================
System uname: 2.6.0-test8-mm1 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.3.11
distcc 2.11.1 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.2 [enabled]
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config
/usr/X11R6/lib/X11/xkb /opt/tomcat/conf /usr/kde/3.1/share/config /usr/share/texmf/tex/generic/config/
/usr/share/texmf/tex/platex/config/ /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="sandbox autoaddcvs ccache distcc prelink"
GENTOO_MIRRORS="http://ftp.easynet.nl/mirror/gentoo/ ftp://ftp.easynet.nl/mirror/gentoo/
ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 oss apm avi crypt cups encode foomaticdb gif jpeg libg++ mad mikmod
mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib directfb
gtkhtml alsa gdbm berkdb slang readline arts tetex nas bonobo svga ggi tcltk
guile X sdl gpm tcpd pam libwww ssl perl python esd imlib oggvorbis gnome
gtk qt kde motif opengl mozilla gphoto2 ldap snmp cdr scanner acpi acpi4linux
apache2 artswrappersuid dga dvd ethereal evo fbcon gb gtk2 gtk2i java jikes
joystick lcms maildir mmx moznocompose moznoirc oav pcmcia pic pnp ppds S3TC
samba sse tiff transcode trusted usb xml"
---------------

Oh, and compiling the example program says "cannot find..." too.

[1] During the last few days I had already quite a few relatively strange
problems when emerging packages. These might be related but probably not.
Some of them I could work around by disabling USE Flags (samba-3.0.0-r1 needed
-python -oav to compile) or disabling distcc (kde packages, AFAIK kdelibs
or base, only compiled when distcc was disabled) - quite strange. *sigh*
Comment 2 Paul de Vrieze (RETIRED) gentoo-dev 2003-10-25 13:33:02 UTC
When you run ldconfig -v as root, does it then show libX11 in there?
Which variables are set when you run that gcc? (esp. those starting with
LD)
Comment 3 Daniel Seyffer 2003-10-26 07:35:18 UTC
I don't know about the original reporter, but for me this:
   root@mybox # ldconfig -v | grep -i libX11
gives me:
------
ldconfig: Can't stat /opt/eclipse: No such file or directory
ldconfig: Can't stat /usr/games/lib: No such file or directory
ldconfig: Can't stat /usr/lib/fltk-1.1: No such file or directory
        libX11.so.6 -> libX11.so.6.2
        libx11globalcomm.so.1 -> libx11globalcomm.so.1.0.0
ldconfig: /usr/lib/libstdc++-libc6.1-1.so.2 is not a symbolic link
-------
Apparently there are also a few orphande entries...
As far as I am concerned, I suppose I am going to do a clean reinstall anyway.
:-/
(I had KDE-CVS installed (now deinstalled), maybe/probably that broke something.)

 
Comment 4 Paul de Vrieze (RETIRED) gentoo-dev 2003-10-26 08:26:29 UTC
What you can try to do is go to your /etc/env.d directory and remove all
the entries with LD_CONFIG that are orphaned. Also remove the entry belonging
to kde cvs. Then try again.
Comment 5 Tomasz Olszewski 2003-10-26 08:34:23 UTC
> ldconfig: Can't stat /opt/eclipse: No such file or directory
> ldconfig: Can't stat /usr/games/lib: No such file or directory
> ldconfig: Can't stat /usr/lib/fltk-1.1: No such file or directory

This is not really a problem. You have those paths in your /etc/ld.so.conf,
but they don't really exist in your system. Ldconfig tries to search them
for libraries but fails (for obvious reasons). I think you shouldn't worry
about this.

> ldconfig: /usr/lib/libstdc++-libc6.1-1.so.2 is not a symbolic link

See this: http://bugs.gentoo.org/show_bug.cgi?id=28644 or just do a ACCEPT_KEYWORDS="~x86"
emerge =lib-compat-1.2-r1
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-10-26 10:34:45 UTC
The orphaned directories are indeed not an issue.  Just marked lib-compat
stable
that fixes the other issue.

As for the other issue (X11 not found), not sure.
Comment 7 Daniel Seyffer 2003-10-27 15:45:52 UTC
Thanks for pointing out how to clean up the LD_LIBRARY_PATH. Well, in fact
I already knew but was so far just a bit too lazy to clean up. ;-)
(Oh, but no remainders of kde-cvs were left in /etc/env.d or the library
path...)

Never mind. This isn't really a serious issue for me because I am going to
reinstall Gentoo on my new hardware anyway and will more or less just take
over my /home. Tomasz, I also didn't intend to "capture" your bugreport,
just wanted to say "me2". ;-)
Comment 8 SpanKY gentoo-dev 2003-11-29 14:42:27 UTC
ok, this bug should be cleaned up ...

the issue is this:
if i have /usr/X11R6/lib in /etc/ld.so.conf, then should this command work:
gcc test.c -lX11
or, should the command be this:
gcc test.c -lX11 -L/usr/X11R6/lib

currently, only the second one works ... and as far as i know, it should be that way.  thus we come back to the original bug ... please provide the package that failed to locate Xpm and the output of that command

Daniel's bug with kde-cvs is completely unrelated to this report