www.digitalmars.com         C & C++   DMDScript  

D.gnu - cross compile

reply BCS <ao pathlink.com> writes:
How hard would it be to get gdc to cross compile to ppc from an x86 box?
Feb 24 2008
parent reply Gregor Richards <Richards codu.org> writes:
BCS wrote:
 How hard would it be to get gdc to cross compile to ppc from an x86 box?
 
 
I haven't tried it, but I can't imagine it would be too difficult so long as you have the PPC binutils and libc installed to the right places. I've made a lot of cross-compilers, so if you some errors crop up in the process I can probably figure out what's wrong. - Gregor Richards
Feb 25 2008
parent reply BCS <ao pathlink.com> writes:
Reply to Gregor,

 BCS wrote:
 
 How hard would it be to get gdc to cross compile to ppc from an x86
 box?
 
I haven't tried it, but I can't imagine it would be too difficult so long as you have the PPC binutils and libc installed to the right places. I've made a lot of cross-compilers, so if you some errors crop up in the process I can probably figure out what's wrong. - Gregor Richards
To the best of my memory, I have only ever worked on one computer with a cross compiler* so I guess the real question should be "How hard would it be to cross compile to ppc from an x86 box?" Also I've never used gdc so everything but D would be new to me in that venture. *it was a Green Hills compiler, I will cross compile by hand befor I volenter to use that again! good compiler, bad interface.
Feb 25 2008
parent reply BCS <ao pathlink.com> writes:
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.
Feb 25 2008
parent reply Gregor Richards <Richards codu.org> writes:
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 (http://ftp.gnu.org/gnu/binutils/) $ mkdir build $ cd build $ ../configure --prefix=/opt/crossc/powerpc-linux-gnu \ --target=powerpc-linux-gnu $ make all install 2) libc. Download the appropriate one from packages.debian.org, 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 \ --target=powerpc-linux-gnu $ make all install You can also use Crosstool (www.crosstool.org), 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
Feb 25 2008
parent BCS <ao pathlink.com> writes:
Reply to Gregor,

 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.
the target would be either the Green hills INTEGRITY RTOS* or a as yet not written RTOS by another company. I think they will have malloc and whatnot so I think I should be able to get /somthing/ working (extern (C) void doit(){ printf("hello world\n");} )

thanks, I'll file that away in hopes that I find time to work on that befor 
bit rot gets to it. Hell, I might even be able to work it into my job and 
get paid for it!

 
 - Gregor Richards
 
* if you ever see INTEGRITY on a job sheat and don't see lots of zeros, keep looking. It's not fun to work with.
Feb 25 2008