[yocto] Forcing link order for autotools recipe

Chris Tapp opensource at keylevel.com
Mon Sep 17 12:04:28 PDT 2012


On 17 Sep 2012, at 06:51, Khem Raj wrote:

> On Sat, Sep 15, 2012 at 4:59 PM, Chris Tapp <opensource at keylevel.com> wrote:
>> I've got a recipe that uses autotools. It builds ok under Poky, but if I try to build it on my host (e.g. when developing) then it fails to build with lots of 'symbol not found' link errors related to libs that are on the system and which are in the gcc lib search path.
>> 
>> I've finally tracked this down to link order. The final command is of the form:
>> 
>> g++ -lGL -lcurl -o binary a.o b.o
>> 
>> If I change this to:
>> 
>> g++ -o binary a.o b.o -lGL -lcurl
>> 
>> then it builds ok.
>> 
>> Stranger still is the original form works fine on another system (older Ubuntu). The ld versions are different (2.21.53 on the one that fails, 2.20.1 on the one that works).
>> 
>> Can I get autotools to always link the libraries last?
> 
> you did not mention the failing distro but what Ross mentioned could
> be one reason

It's Ubuntu 11.10. I don't think it's using 'gold', but it is on the system. I'll look at the default flags to see what's up.

> another reason could be that its using gold as default linker where
> overlinking is not the default as it used to be. The linking behavior
> is correct there you need to fix the application to specify the
> libraries correctly.


Yes, that's exactly what I did once I realised I was using LDFLAGS when I should use LDADD.
It was once of these 'coincidentaly-correct' errors that only bites after a year or two or working perfectly ;-)

Chris Tapp

opensource at keylevel.com
www.keylevel.com






More information about the yocto mailing list