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 ...
Stupid question but have you tried using -rpath or -rpath-link as the error shows?
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 ...
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)
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)
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/
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/]
Mike this can be closed right? Fixed by your patch, now in mainline?
thought i had closed this ... yeah, is all fixed now with the binutils patch i sent upstream for ld.so.conf searching