[yocto] Forcing link order for autotools recipe [SOLVED]

Chris Tapp opensource at keylevel.com
Sun Sep 16 03:08:37 PDT 2012


On 16 Sep 2012, at 00:59, Chris Tapp 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?


Turns out there was a problem with one of my makefiles - it was using LDFLAGS to add the libs when it should have used LDADD (which puts them at the end of the command line).

That'll teach me to blindly copy from else where ;-) Strange it's worked up till now...

Chris Tapp

opensource at keylevel.com
www.keylevel.com






More information about the yocto mailing list