This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Generating a cross compiler
- From: Ian Lance Taylor <iant at google dot com>
- To: David Dudley <ddudley at bnl dot gov>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 11 Oct 2011 06:53:47 -0700
- Subject: Re: Generating a cross compiler
- References: <CAB9AFE3.63E7%ddudley@bnl.gov>
David Dudley <ddudley@bnl.gov> writes:
> I need to generate a cross compiler that will run on my OSX Darwin computer,
> and generate objects for a i686-pc-linux-gnu system.
Building a cross-compiler for a GNU/Linux system is painful. There are
some scripts floating around. You should look for those. crosstool-ng
is one.
> The compiler builds fine till it gets to needing crti.o, crt1.o, libc.a, and
> libm.a. I would have thought that pieces required for the compiler itself
> would have been built in the compiler. IÂm using the include files from the
> target Linux system to build things (since it wouldnÂt get to this point
> without them. If youÂre building a cross compiler to build the target
> system, what sense does it make to require files from the target, which
> might not exist yet?).
You have to stage the build. The files you mention are, as you know,
part of glibc, not gcc. gcc is just a compiler and deliberately does
not include a library. The same issue arises for any cross-compilation:
you need to provide a library.
> IÂm trying to build everything (binutils, gcc, gmp, mpfr, mpc) in a single
> pass which doesnÂt work with mpc as it fails if gmp and mpfr arenÂt already
> installed. IÂm assuming that crti and the other libs I need are probably in
> glibc, so is there a way I can link it into my combined director to build as
> a part of the process?
You can't do a GNU/Linux cross-build in a single pass.
Ian