[En-Nut-Discussion] Unable to compile 'simple': circular references between libraries

Urs Zurbuchen going_nuts at myredirect.net
Sat Jan 28 00:53:17 CET 2006


I had similar problems. Didn't remember the gcc one-pass strategy and 
couldn't get it to link correctly...

I added the following line to lib/Makefile as the last for the install 
target.
find .. -name \*.o -print | xargs ar rs gcc/unix/libethernut.a

I could then link with -lethernut.

Doesn't work natively on Windows, though.

Regards,
...urs

Henrik Maier wrote:

> Hi!
>
> I had similar linker issues with various Nut/OS projects.
>
> The gcc linker cannot resolve circular references between libraries. 
> Depending on the Nut/OS functions used in a project, I found one 
> always has to reorder libraries and add them multiple times.
>
> I suggested in an earlier post to drop the concept of splitting Nut/OS 
> in separate libraries and just to have one library libnutosall.a.
>
> Another option is to embed the libraries in start-group/end-group 
> linker options. gcc will then search the libraries multiple times to 
> resolve circular references between libraries. For example:
>
> -Wl,--start-group -lnutpro -lnutos -lnutarch -lnutdev -lnutnet -lnutfs 
> -lnutcrt -Wl,--end-group
>
> Henrik Maier
> http://www.proconx.com
>
>
> Lloyd Bailey wrote:
>
>> Hi,
>>
>> I had the same problem, so I re-ordered the libraries (swopped  nutdev
>> and nutarch and add nutdev at the end.
>>
>> I hope this helps,
>>
>> Lloyd.
>>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion





More information about the En-Nut-Discussion mailing list