linking with -Wl,-rpath and $(prefix)

David Carter-Hitchin david@carter-hitchin.clara.co.uk
Fri Dec 2 23:47:00 GMT 2005


Hi,

Someone recently mentioned on this group a method to affect linking.  It
was:

-Wl,-rpath,$(prefix)/lib

I've seen some information about this in the FAQ but perhaps it's late in
the day or something but I really don't fully understand what is achieved
here and how.  If I read the FAQ correctly one would pass this into GCC when
compiling one's code so that the resultant user binary resolves its
dependencies in the normal way but with the extra help of the directories
specified by -rpath.  Is that correct? If so does $(prefix) equal the prefix
set when GCC itself was compiled with ./configure --prefix=<dir> ?

Or perhaps this -Wl option is passed into GCC itself when it is compiled?

Is there a page with a fuller explanation of how GCC linking works?

Thanks,
David.



More information about the Gcc-help mailing list