Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 73003 - -rpath fails with binutils
Summary: -rpath fails with binutils
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
: 75914 (view as bug list)
Depends on:
Reported: 2004-12-01 00:57 UTC by Ingo Krabbe
Modified: 2005-01-18 07:36 UTC (History)
1 user (show)

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

a small test program with library. You will need cweb for the make process. (TestCase.tar.gz,5.65 KB, application/octet-stream)
2004-12-01 22:33 UTC, Ingo Krabbe
rpath.tar.bz2 (rpath.tar.bz2,613 bytes, application/octet-stream)
2004-12-03 23:39 UTC, SpanKY

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Krabbe 2004-12-01 00:57:37 UTC
The binutils 20040303 got updated in the stable branch last days, resulting in a development system that doesn't handles the rpath feature anymore.

Some tests revealed that -rpath doesn't work with binutils/ld of that version.  The binutils/ld of the cvs -co (2.15.94 20041130) works fine with the same object files here,  which I will take as a strong evidence that it is really a bug to use binutils 20040303 as a stable tool !  Please switch back or move towards a newer version in the portage distribution.

Reproducible: Always
Steps to Reproduce:
1.Write a small library loading program it with gcc -o prog obj.o -rpath ./lib
3.Try to start ./prog with the library in lib.
4.As a cross check you can start "LD_LIBRARY_PATH=./lib ./prog" to see
  that the program really works and loads the library from ./lib as expected.

Actual Results:  
LOAD ERROR in cannot open shared object file: No such file or directory 
(message from my program that embeds a mysql server in a shared object) 

Expected Results:  
(that is the message about the successfull start of the mysql server after I    
start the same program text with LD_LIBRARY_PATH ;)) 

Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, 
glibc-, i686) 
System uname: i686 AMD Athlon(tm) Processor 
Gentoo Base System version 1.4.16 
Autoconf: sys-devel/autoconf-2.59-r5 
Automake: sys-devel/automake-1.8.5-r1 
Binutils: sys-devel/binutils- 
Headers:  sys-kernel/linux-headers-2.6.99,sys-kernel/linux-headers-2.4.21-r1 
Libtools: sys-devel/libtool-1.5.2-r7 
CFLAGS="-march=athlon -O3 -pipe" 
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" 
CXXFLAGS="-march=athlon -O3 -pipe" 
FEATURES="autoaddcvs autoconfig buildpkg candy ccache distlocks sandbox 
sfperms userpriv usersandbox" 
USE="X Xaw3d acpi alsa apm arts avi berkdb bitmap-fonts bonobo bzlib cdr crypt 
ctype divx4linux doc dvb encode esd f77 fam fftw flac foomaticdb fortran ftp 
gcj gdbm gif gnome gpm gstreamer gtk gtk2 gtkhtml icq imagemagick imlib java 
jikes joystickjpeg junit kde kerberos ldap libg++ libwww lprng mad maildir 
mikmod mime motif mozilla moznocompose moznoirc mozp3p mozsvg mozxmlterm mpeg 
mysql ncurses nls odbc oggvorbis ooo-kde opengl oss pam pdflib perl php png 
posix python qt quicktime readline satellite scanner sdl slang soap sockets 
spell ssl svg svga tcpd tetex tiff truetype usb vim-with-x x86 xalan xml2 
xmlrpcxmms xv zlib"
Comment 1 SpanKY gentoo-dev 2004-12-01 10:15:25 UTC
could you post a small test case ?

does fail too ?
Comment 2 Ingo Krabbe 2004-12-01 22:33:23 UTC
Created attachment 45117 [details]
a small test program with library.  You will need cweb for the make process.

I don't have the version here so it would be nice if you could
test that.
Comment 3 SpanKY gentoo-dev 2004-12-03 23:39:54 UTC
Created attachment 45244 [details]

even simpler test app
Comment 4 SpanKY gentoo-dev 2004-12-03 23:42:27 UTC
the test application you attached was a mess ... no idea how to use it :p

so i made one ... it builds a sample .so with a single func and then builds a small program which basically dlloads the .so, grabs the func with dlsym, and then runs the func

$ ld --version
GNU ld version 20040303
$ make
cc -Wall  -ldl -Wl,-rpath ./lib/  test-rpath.c   -o test-rpath
cc -shared -o libtest.c
root@vapier 0 rpath # make clean all test
rm -f test-rpath
rm -f lib/*
cc -Wall  -ldl -Wl,-rpath ./lib/  test-rpath.c   -o test-rpath
cc -shared -o libtest.c
cp lib/

$ readelf -d test-rpath | grep rpath
 0x0000000f (RPATH)                      Library rpath: [./lib/]
Comment 5 Jacek Sieka 2005-01-06 04:43:38 UTC
*** Bug 75914 has been marked as a duplicate of this bug. ***
Comment 6 Jacek Sieka 2005-01-06 04:46:03 UTC
Bug 75914 contains some additional info (confirms the bug for amd64 at least=) and another simple test case (largely equivalent to this one).
Comment 7 SpanKY gentoo-dev 2005-01-11 16:14:49 UTC
binutils- is x86 stable now
Comment 8 Jacek Sieka 2005-01-18 01:52:42 UTC
(technically, that leaves at least amd64 unresolved, unless I missed an ebuild update)
Comment 9 SpanKY gentoo-dev 2005-01-18 07:36:12 UTC
that technically is probably correct, but non-x86 arches update their packages on their own schedule