cross compile

Gregor Richards Richards at
Mon Feb 25 19:19:50 PST 2008

BCS wrote:
> Reply to Benjamin,
>> "How hard
>> would it be to cross compile to ppc from an x86 box?"
> Let me be a bit more specific: am I looking at 5 min to get it set up or 
> more like an afternoon or a week? Also It just occurred to me that while 
> the box I'd be using is actually connected to the Internet, the settings 
> for yum and such are so foobared that it might as well not be.

I should note: Are you talking about a non-proprietary OS? If you are, 
easy. If you're not, not so much. Mac OS X in particular is difficult 
unless you get the version straight from Apple.

Otherwise: Probably a couple hours. It's about 30 minutes of compilation 
and two to four hours of banging your head against the wall. Here's the 
basic idea:

0) Choose your prefix and add it to your PATH (I'm using 
/opt/crossc/powerpc-linux-gnu here, so
    $ export PATH="/opt/crossc/powerpc-linux-gnu/bin:$PATH"

1) binutils (
    $ mkdir build
    $ cd build
    $ ../configure --prefix=/opt/crossc/powerpc-linux-gnu \
    $ make all install

2) libc. Download the appropriate one from, and 
extract it:
    $ ar x <foo>.deb
    $ tar -C /opt/crossc/powerpc-linux-gnu/powerpc-linux-gnu \
      vzxf $PWD/data.tar.gz

3) Same idea for the libc-dev package

4) GCC (with GDC). If you have libc installed properly, this shouldn't 
be too tough:
    $ mkdir build
    $ cd build
    $ ../configure --prefix=/opt/crossc/powerpc-linux-gnu \
    $ make all install

You can also use Crosstool (, but that doesn't support 
GDC (so you'd still need to do the GCC step), and if something goes 
wrong, there's really not much you can do to fix it. That being said, it 
usually works, it's just sort of pointless if you need GDC.

Anyway, after you have it installed, it's just powerpc-linux-gnu-gdc

  - Gregor Richards

More information about the D.gnu mailing list