Sample Header Ad - 728x90

Force linker to find stdc++ library in non-standard directory

0 votes
1 answer
3508 views
I've read **a lot** of guidance that says the LD_LIBRARY_PATH is searched before anything else, but one of my .so libraries is linking with libtdc++.so.6 in /usr/lib64. ldd mylib.so: ... libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f82abd18000) ... I want mylib.so to link with libstdc++.so.6 in another location, like /apps/gcc_4.8.0/lib/libstdc++.so.6 So I add /apps/gcc_4.8.0/lib to LD_LIBRARY_PATH, which ***does not*** have /usr/lib64 in it, but it still doesn't find it there. If I add: setenv LD_PRELOAD /apps/gcc_4.8.0/lib/libstdc++.so.6 to my environment, there are no more linker errors. Yay, but that doesn't solve the problem. Users downstream aren't going to want to depend on this library being in the proper place. WHY ISN"T LD_LIBRARY_PATH BEING SEARCHED FIRST!?!
Asked by KyleEnglish (1 rep)
Jun 10, 2016, 03:25 PM
Last activity: Apr 12, 2025, 03:05 AM