Usage of uClibc - newbie question

Rob Landley rob at landley.net
Thu Nov 17 15:51:03 UTC 2005


On Thursday 17 November 2005 06:35, Leon Brits wrote:
> Hi all,
>
> I've never worried about which libc I compiled against until now that I
> need to work with source that must not be GPL but BSD or LGPL. So enter
> uClibc...

And glibc isn't lgpl?

> So my question is:
> Is it true that if I now want to compile a program against these uClibc
> libraries, I only need to add "-nostdlib -nostartfiles" to my gcc
> command line as well as the directory path to the uClibc libraries with
> the -L switch? [Or must I use a toolchain compiled with the uClibc?]

You need to avoid linking against the standard libraries, including the 
standard headers, and then there's a few extra libraries you have to include 
like crt0 to get the code that calls main().

Once long ago I set out to link "hello world" against uClibc entirely by hand, 
and I eventually did.  It was  abit of a pain:

http://www.uclibc.org/lists/uclibc/2003-September/006875.html

And even _then_ there was the problem that libgcc linked against glibc, so it 
was tough not to suck in glibc by accidentally using various built-in gcc 
functions like performing 64 bit division on a 32 bit platform or what have 
you.  (These sorts of intermittent but unsolvable issues were the reason the 
wrapper was abandoned and everybody went "just build a uClibc toolchain".)

That said, we should explain a little better about how to build a toolchain.  
I have a shell script that does it (http://www.landley.net/code/firmware) but 
that's not the same as good documentation...

> Thanks for your time!
> Leon

Rob



More information about the uClibc mailing list