Rpath is exactly that. It will overwrite the default search path and stuff set in LD_LIBRARY_PATH. Just tell gcc to pass it through to the linker.
Up vote 4 down vote favorite 1 share g+ share fb share tw.
So. I have a problem where I have two versions of GCC on a machine. 3.4.6 and 4.1 This is due to some dependency issues with a new piece of software.
(requires glibc 4.1) When I go to link this new software with the 4.1 libraries it links fine. However, when it comes to executing the software it can't find the library, because it is looking at 3.4.6 in my LD_LIBRARY_PATH. If I set LD_LIBRARY_PATH to the 4.1 lib it blows up the shell,among killing other things, because the 3.4.6 libraries are used for that.
Its a bit of a catch 22. Is there any way that at link time I can give an absolute path to that shared library without using the LD_LIBRARY_PATH? This way I can hopefully have both versions, but only use 4.1 for this specific application?
Gcc g++ linker glibc link|improve this question edited Jan 15 '09 at 20:50Ignacio Vazquez-Abrams162k13140280 asked Jan 15 '09 at 20:06windfinder1,80911330 94% accept rate.
Afaik there is no such thing, but programs requiring glibc in an older version should accept never version too, since it is backward compatible. – Ronny Brendel Jan 15 '09 at 20:22 version 4.0 breaks backwards compatibility, I do believe. – windfinder Jan 15 '09 at 20:35.
Rpath is exactly that. It will overwrite the default search path and stuff set in LD_LIBRARY_PATH. Just tell gcc to pass it through to the linker: g++ -Wl,-rpath,/usr/lib/my_4.1 -omy_binary *.
Cpp You can make it show you the search processing (use help to make it give you more options): js@HOST2 cpp$ LD_DEBUG=libs . /a. Out 5859: find library=libc.so" rel="nofollow">libc.so.6 0; searching 5859: search path=/usr/lib/my_4.1/tls/i686/sse2:/usr/lib/my_4.1/tls/i686: /usr/lib/my_4.1/tls/sse2:/usr/lib/my_4.1/tls: /usr/lib/my_4.1/i686/sse2:/usr/lib/my_4.1/i686: /usr/lib/my_4.1/sse2:/usr/lib/my_4.1 (RPATH from file .
/a. Out) 5859: trying file=/usr/lib/my_4.1/tls/i686/sse2/libc.so" rel="nofollow">libc.so.6 5859: .... 5859: search cache=/etc/ld.so. Cache 5859: trying file=/lib/libc.so" rel="nofollow">libc.so.6 (note: found here!
) 5859.
Not really an answer to your question, but an alternate solution: you should be able to fix up your issues by adding your new lib path to /etc/ld.so. Conf and running ldconfig as root.
I.e. Instead of setting it globally as an exported variable, run your program as LD_LIBRARY_PATH=/path/to/4.1/libs my_executabel? -k.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.