Thread overview
Porting GDC?
Apr 10, 2007
Stephen Waits
Apr 16, 2007
Stephen Waits
Apr 16, 2007
Stephen Waits
Apr 22, 2007
Chad J
Apr 23, 2007
Stephen Waits
May 01, 2007
Mike Groble
May 01, 2007
Stephen Waits
April 10, 2007
What's involved in getting gdc on a new platform?

Is there a "C" backend for GCC - such that we could have a GDC which compiles D into C?

Thanks,
Steve
April 16, 2007
Stephen Waits wrote:
> What's involved in getting gdc on a new platform?
> 
> Is there a "C" backend for GCC - such that we could have a GDC which compiles D into C?

Anyone?

--Steve
April 16, 2007
Stephen Waits wrote:

>> Is there a "C" backend for GCC - such that we could have a GDC which compiles D into C?
> 
> Anyone?

http://www.dsource.org/projects/tdc/, mayhap ? ("Trivial D Compiler")

Do see http://www.dsource.org/projects/tdc/wiki/WhatsSupported first.

--anders
April 16, 2007
Anders F Björklund wrote:
> 
> http://www.dsource.org/projects/tdc/, mayhap ? ("Trivial D Compiler")

Thanks.

--Steve
April 22, 2007
Stephen Waits wrote:
> What's involved in getting gdc on a new platform?
> 
> Is there a "C" backend for GCC - such that we could have a GDC which compiles D into C?
> 
> Thanks,
> Steve

Sorry for the late response, I don't have much time to chill on the newsgroup these days.

I'd say first get GCC running and producing valid executables on your PS3.  Then once you've done that and you are comfortable with the config/build process of GCC, then build GCC again with the GDC module installed.  It will probably throw errors and complain a lot.  Then the fixing/tweaking/pain happens.  Hopefully the PS3 has an OS that is similar to Windows, Linux, or MacOS.  Hopefully the PS3 has an OS ;) When your compiler compiles and starts working on the library (probably gphobos in this case), make sure it is passing version statements for the platform most similar to what you are working with (ex: Windows if the target OS is similar to Windows).  You will probably need to alter the make and configure files in the D add-on.  I can't help you much further than that because the porting I did with arm-wince-pe and the PS3 porting are probably quite different in the details.

A couple points I'd like to mention:
- If you can run GCC on the PS3, it makes things nicer.  I had to build a cross-compiler (as opposed to a normal compiler) for arm-wince-pe, which was time consuming.
- If GCC already targets the PS3, or some variant(s) does, and the build process is simple, life is easier.  I had some reference work to help me with arm-wince-pe, but no shrink wrapped build process; I had to figure that out, which was time consuming.

Good luck with your PS3 porting endeavor!
I would really like to see this happen.  Maybe I will write a game for PS3 in D someday :)
April 23, 2007
Chad J wrote:
> Good luck with your PS3 porting endeavor!
> I would really like to see this happen.  Maybe I will write a game for PS3 in D someday :)

Thanks for the tips Chad.

Now I just need an extra few hours in the day, or to magically find an intern who understands how to work with gcc.  Seriously though, I do want to write my next game on PS3 in D and once we wrap up what we're doing now, I plan on taking a strong look at this.

BTW - gcc does already work on PS3.. PS3 Linux (which anyone can install on their own PS3) includes it.  They have compilers for both SPE and PPE.  That will be my starting point.

--Steve
May 01, 2007
I tried building GDC on my PS3.  I got to a certain point and gave up.

I am running YDL on my PS3.  I downloaded the SDK 2.1 source RPMs from the Barcelona site (http://www.bsc.es/plantillaH.php? cat_id=304). I installed GDC 0.23 on top of the ppu-gcc code and tried to build natively on the PS3.

First is that the cell version modifies floating point macros that break code in in d-gcc-real.cc.  I don't know exacly what I am doing.  To get past the errors, I changed lines like:

 REAL_ARITHMETIC(x.rv(), MINUS_EXPR, rv(), r.rv());

to
 REAL_ARITHMETIC(x.rv(), MINUS_EXPR, rv(), r.rv(), max_float_mode
());

Note, there are more macros that changed than just this one, but I modified all the same way to give them the required machine_mode parameter they wanted.

The compiler built after that, but then phobos failed compiling.  I don't remember the exact error, but the error message mentioned some floating point function like sqrt.

It seems to me that there will need to be some work to get the floating point capabilities provided by the cell processors to work correctly with GDC.  My real interest is getting it to run on the spu-gcc version of the compiler which I think will be harder still.  I did enough to realize I am a little over my head and the build doesn't work "straight out of the box". I'd be willing to try some experiments if people have suggestions.
May 01, 2007
Mike Groble wrote:
> I tried building GDC on my PS3.  I got to a certain point and gave
> up.

Thanks for the report Mike.

--Steve