This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Setting up a cross-compile
- From: David Daney <ddaney at avtrex dot com>
- To: Dave Williss <dwilliss at microimages dot com>
- Cc: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Date: Fri, 01 Jun 2007 08:08:28 -0700
- Subject: Re: Setting up a cross-compile
- References: <466033EF.1000100@microimages.com>
Dave Williss wrote:
I'm sure there must be documentation somewhere on how to do this, but
I can't find it.
I want to setup a Linux or Mac OS machine to compile and link programs
for a Sun SPARC target.
I know that gcc can be built to cross-compile for another platform,
but apart from specifying the target architecture, I don't know what
all I need to do.
One thing that I'm sure of is that when this gcc is called, I need it
to ignore /usr/include and /usr/lib and pull things from some other
directory where I will have to have copied the SPARC versions. Is
there a configuration option to tell it where those will be, or do I
have to somehow override them at runtime?
You put all you headers and libraries in some directory that will be
called the 'sysroot', then you tell GCC's configure script where they
are. For my mipsel-linux cross compiler I configure like this:
$ ../gcc-4_2-branch/configure --target=mipsel-linux
--with-sysroot=/usr/local/mipsel-linux-test
--prefix=/usr/local/mipsel-linux-test --with-arch=mips32
--with-float=soft --disable-libmudflap --disable-tls
--enable-languages=c,c++
If you also need to create a suitable libc and header files I suggest
you look at the crosstool project.
David Daney