[Clfs-support] Building extra software

Andrew Bradford andrew at bradfordembedded.com
Mon Sep 19 06:41:30 PDT 2016


Hi Chris,

On 09/14 11:36, Chris Smith wrote:
> Hi,
> 
> I have successfully built a base system using CLFS-embedded (arm) and I’m now looking to build additional software for it.  Are there any guides out there which show the general steps needed to take a generic source package X and build it successfully in a CLFS environment?  Dos/Don’ts, things to look out for, etc?

For other software you might want to build, you can check out CBLFS [1]
which has some tips, although it might take a little work to have the
instructions work for the embedded book.

[1]: http://cblfs.clfs.org/index.php/Main_Page

> Also, is there any resource that discusses in detail the reasons for building GCC twice, statically then dynamically?  I get that it’s necessary, I just don’t get exactly why.

The first pass of building GCC is static as there's not yet a C library
for the target that the building of GCC can use, so the newlib C library
is used (its a part of the GCC source code).  Newlib is the same C
library you'd likely use if you were compiling for a bare-metal target
like a microcontroller, as it provides basic C library routines but
isn't necessarily a good choice for a Linux C library.

You can't build a C library for the target till you have some kind of
cross compiler, so due to this little chicken/egg problem, newlib is
used as a stand-in.

Once you have a static GCC, you can then build a C library (musl, glibc,
etc).  And now, since you have a cross compiler and a C library, you can
build a "real" GCC which knows how to call C library mechanisms and do
dynamic linking.

This can likely be much better explained in the book(s).  I've opened a
trac ticket so I remember to do this at least for the embedded book [2].

[2]: http://trac.clfs.org/ticket/1119

Thanks,
Andrew



More information about the Clfs-support mailing list