Re: Setting up a cross-compile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux