cross compiling thoughts
Jim Wilson
wilson@specifixinc.com
Wed Dec 10 05:54:00 GMT 2003
Axel Scheepers wrote:
> The above procedure produces a nice set of cross compiling tools to
> build c and c++ sources. But... I was wondering if this was the right
> way to do it; This time I could easily get the needed includes and libs
> from the freebsd target host, but what if I wanted to use a platform
> which I didn't have access too?
There is a good reference on cross compilers builds at
http://www.kegel.com/crosstool
It mostly concerns building linux crosses.
If you already have libraries and header files, then you can tell gcc to
use them. The old scheme is to use --with-headers=/--with-libs= options
to point to the targets headers and libraries. The new scheme is to use
--with-sys-root= which points to a file system root for the target.
This allows support for targets with headers/libraries in multiple
directories.
If you don't already have libraries and header files, then you have to
build them in parallel with gcc somehow. This can be a bit complicated
for glibc. The kegel.com site has info on a good way to do it. For
other targets, like freebsd, you would have to work up a similar procedure.
> I did some googling, and it seems there is also a 'newlib'. Is this
> compatible with glibc? e.g. Can I cross build files for a host which
> only has glibc? Never had a look at it, I should.
newlib was designed for embedded targets which have no library of their
own. It is unlikely that you would want to use newlib for any unix like
OS. newlib does build fairly easily in parallel with gcc.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list