is there any way to change the order of name resolution in linking (aside from putting the libraries in the right order?)
Dan Hitt
dan.hitt@gmail.com
Sun Sep 30 01:06:00 GMT 2012
Thanks Sundara.
Actually, i tried several variations to try to specify the extension.
These are the variations i tried, with the results:
-lX11 (found, but does not resolve symbols)
-lX11a (cannot find)
-lX11.a (cannot find)
lX11 (cannot find)
libX11 (cannot find)
libX11a (cannot find)
libX11.a (cannot find)
llibX11.a (cannot find)
-llibX11.a (cannot find)
Just for reference, these go in the arguments as
-Wl,--whole-archive,<<library goes here>>,--no-whole-archive
and so far, the only things that don't bail are -lX11 and
/usr/lib/...../libX11.a,
and the latter is the only thing that actually resolves any symbols.
dan
On Fri, Sep 28, 2012 at 6:13 AM, Vardhan, Sundara (GE Transportation)
<sundara.vardhan@ge.com> wrote:
> Hi Dan
>
> I think -l defaults to .so and does not include .a if the extension is
> not explicitly mentioned. However, I am not sure if anything in this
> area changed in the latest gcc.
>
> Regards
>
> Vardhan
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
> Behalf Of Dan Hitt
> Sent: Thursday, September 27, 2012 4:17 PM
> To: Jonathan Wakely
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: is there any way to change the order of name resolution in
> linking (aside from putting the libraries in the right order?)
>
> On Thu, Sep 27, 2012 at 1:08 PM, Jonathan Wakely <jwakely.gcc@gmail.com>
> wrote:
>> On 27 September 2012 21:04, Dan Hitt wrote:
>>>
>>> I was not able to use the -l abbreviation
>>
>> Why not?
>
> It didn't resolve the reference.
>
> To be really specific here (except that i have to suppress some of the
> dozens of characters in the command), the command generated was:
>
> gcc-4.6 -Wl,--whole-archive,-lX11,--no-whole-archive [[[other stuff
> deleted]]]
>
> And that command gives the same result as just putting -lX11 first (as
> opposed to putting it last, which resolves everything).
>
> (It may be that the -l option somehow signifies *.so these days?
> Because it certainly gives a much smaller executable when it works, and
> i had to use the *.a forms with --whole-archive in order to make it
> work?)
>
> dan
More information about the Gcc-help
mailing list