This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Unable to link to library version of my choice
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Marco Ricci <marcoricci2012 at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 1 Mar 2012 23:24:35 +0000
- Subject: Re: Unable to link to library version of my choice
- Authentication-results: mr.google.com; spf=pass (google.com: domain of jwakely.gcc@gmail.com designates 10.152.135.198 as permitted sender) smtp.mail=jwakely.gcc@gmail.com; dkim=pass header.i=jwakely.gcc@gmail.com
- References: <alpine.DEB.2.02.1202290901120.2617@laptop-mg.saclay.inria.fr> <1330633335.51040.YahooMailClassic@web122403.mail.ne1.yahoo.com>
On 1 March 2012 20:22, Marco Ricci wrote:
> Thanks to both you and Jonathan Wakely for responding.
>
>> I guess you checked that with ldd on your program, not
>> strace on the build?
>
> Correct, but I also had some printf statements and so it was clear at run time as well.
>
>> There are 2 operations called linking. One is when you
>> create the binary file. Another one is when you run it. -L
>> tells where to look for libraries during the first one.
>> -rpath (it is a linker option, so you want -Wl, in front)
>> tells where to look during the second one.
>
> So I should use both -L option and -Wl option while compiling?
Yes, -Lxxx -Wl,-rpath,xxx where xxx is the path to the library.