building native cross compiler
Ian Lance Taylor
iant@google.com
Mon Mar 14 20:20:00 GMT 2011
Michael Zintakis <michael.zintakis@googlemail.com> writes:
> From what I gather by reading the INSTALL (and FAQ) files from the
> source archives I would need to build glibc separately, after I built
> binutils, use the same prefix and probably specify the
> "--with-headers" option as well. I take it glibc won't be relying on
> the GCC cross-compiler otherwise we have a chicken-and-egg scenario on
> our hands?
There is a chicken-and-egg scenario. You need to first build a vanilla
cross-compiler without building the library. You need to use that to
build glibc. Then you need to use glibc to build the full
cross-compiler.
> "You must first build the library (`make'), optionally check it
> (`make check'), switch the include directories and then install (`make
> install'). The steps must be done in this order. Not moving the
> directory before install will result in an unusable mixture of header
> files from both libraries, but configuring, building, and checking the
> library requires the ability to compile and run programs against the old
> library."
>
> Do I need to do this as i am building with a specific prefix and, I
> take it, my original system won't be affected (I won't be chrooted
> yet). If I do need to follow that what does the 'switch the include
> directories' mean?
Right, if you use a different --prefix that shouldn't matter, I think.
> "You may also need to reconfigure GCC to work with the new library.
> The easiest way to do that is to figure out the compiler switches to
> make it work again (`-Wl,--dynamic-linker=/lib/ld-linux.so.2' should
> work on GNU/Linux systems) and use them to recompile gcc."
>
> Do I need to do that too? If so, should I specify the --dynamic-linker
> path to "prefix/target/lib/ld-linux.so.2"?
This is really only an issue when building glibc for your own system
which is not what you are doing.
> "You can install glibc somewhere other than where you configured it
> to go by setting the `install_root' variable on the command line for
> `make install'. The value of this variable is prepended to all the
> paths for installation. This is useful when setting up a chroot
> environment or preparing a binary distribution. The directory should be
> specified with an absolute file name."
>
> Same here - I assumed when specifying the prefix that will be enough
> (without specifying 'install_root') or is it?
It is enough.
> Finally, in the same file there is mention that I would also need the
> header files for the Linux arch (presumably the target arch as I
> already have the host ones installed) - is that really a requirement?
As far as I know, it is a requirement.
> Also, I take it it is not possible to build glibc at the same time I
> build GCC (i.e. by dropping the source tree into the GCC main tree),
> right?
Right.
Anyhow look at http://kegel.com/crosstool/ .
Ian
More information about the Gcc-help
mailing list