Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 64930 - linking problems in uclibc env
Summary: linking problems in uclibc env
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-21 22:17 UTC by SpanKY
Modified: 2004-10-29 16:00 UTC (History)
0 users

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 SpanKY gentoo-dev 2004-09-21 22:17:59 UTC
here's a brain dump (so that i dont have to this again and again :]) which is the current problem facing our uclibc envs (it outright kills arm but only halts x86 under some extraneous circumstances)

the defaut hardcoded library search path is normally something like:
/lib
/usr/lib
then normally we'll have a few more paths added in via env.d and thus ld.so.conf:
/usr/lib/gcc-lib/arm-pc-linux-uclibc/3.3.4/
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.1/

the problem is only found at link time when compiling things, runtime apps seem to run just fine

for example:
# ldd /lib/libncurses.so
    libgcc_s.so.1 => /usr/lib/gcc-lib/arm-pc-linux-uclibc/3.3.4/libgcc_s.so.1
# echo 'int main(){}' > test.c
# gcc test.c -lncurses
/usr/lib/gcc-lib/arm-pc-linux-uclibc/3.3.4/../../../../arm-pc-linux-uclibc/bin/ld: warning: libgcc_s.so.1, needed by /lib/libncurses.so, not found (try using -rpath or -rpath-link)

however, if we move libgcc_s.so.1 to /lib/, the `gcc test.c -lncurses` works just fine and dandy ... and if we try to run an app that needs ncurses (like nano or less) while libgcc_s.so.1 is in /usr/lib/gcc-lib/arm-pc-linux-uclibc/3.3.4/, the apps work just fine

another example is SDL:
# ldd /usr/lib/libSDL.so
    libstdc++.so.6 => /usr/lib/gcc/i386-pc-linux-uclibc/3.4.1/libstdc++.so.6
# echo 'int main(){}' > test.c
# gcc test.c -lSDL
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.1/../../../../i386-pc-linux-uclibc/bin/ld: warning: libgcc_s.so.1, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.1/libstdc++.so.6, not found (try using -rpath or -rpath-link)

it might also be interesting to note that setting LD_LIBRARY_PATH to the dir the libraries are found in will 'fix' things ...
Comment 1 solar (RETIRED) gentoo-dev 2004-09-21 22:35:57 UTC
Stupid question but have you tried using -rpath or -rpath-link as the error shows?
Comment 2 SpanKY gentoo-dev 2004-09-21 23:07:11 UTC
well, i really dont know where i would pass those arguements ... there's also the fact that a glibc based env doesnt have to utilize -rpath/-rpath-link ...

one thing i did neglect to mention ...
while `gcc -lncurses test.c` will fail to link because libgcc_s.so.1 was not found, `gcc -lncurses -lgcc_s test.c` will work just fine ...
Comment 3 SpanKY gentoo-dev 2004-09-25 01:52:29 UTC
another example with GL:
# gcc test.c -lGL
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libXxf86vm.so.1, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGL.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libXext.so.6, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGL.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libX11.so.6, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGL.so, not found (try using -rpath or -rpath-link)
Comment 4 SpanKY gentoo-dev 2004-09-25 01:54:42 UTC
and finally, one with GLU ... i think these should be enough test cases :)

btw, passing -L params makes no difference (like these GL ones should probably have -L/usr/X11R6/lib)

# gcc test.c -lGLU
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libXext.so.6, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGLU.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libX11.so.6, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGLU.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGLU.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libgcc_s.so.1, needed by /usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../libGLU.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/bin/ld: warning: libXxf86vm.so.1, needed by /usr/lib/libGL.so.1, not found (try using -rpath or -rpath-link)
Comment 5 solar (RETIRED) gentoo-dev 2004-09-25 10:03:44 UTC
Can somebody try with a rpath set??

Something like so should do the trick.
gcc main.c -o main -Wl,--rpath=/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/lib/
Comment 6 solar (RETIRED) gentoo-dev 2004-09-25 10:07:21 UTC
With each additional rpath passed the resulting elf will look in that dir for said libs.

gcc main.c -o main -Wl,--rpath=/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/lib/ -Wl,--rpath=/usr/lib/
solar@simple c $ readelf -d main | grep RPATH
 0x0000000f (RPATH)                      Library rpath: [/usr/lib/gcc/i386-pc-linux-uclibc/3.4.2/../../../../i386-pc-linux-uclibc/lib/:/usr/lib/]
Comment 7 solar (RETIRED) gentoo-dev 2004-10-29 15:54:11 UTC
Mike this can be closed right? Fixed by your patch, now in mainline?
Comment 8 SpanKY gentoo-dev 2004-10-29 16:00:10 UTC
thought i had closed this ...

yeah, is all fixed now with the binutils patch i sent upstream for ld.so.conf searching