Cross compilers; GDC/LDC

Johannes Pfau nospam at example.com
Wed Mar 6 13:09:48 PST 2013


Am Tue, 5 Mar 2013 00:16:08 +1000
schrieb Manu <turkeyman at gmail.com>:

> Wowzer! That's awesome! :)
> 
> So, I don't understand this whole crosstools-NG thing, how did you do
> that so easily?
> 
> So, aside from doing these tests I'm working on now, let's say I were
> working on some games console projects, how hard is it to integrate
> the console patches (like the ones linked in my prior email) into
> this build system to make actual working compilers for those
> platforms? This seems like an amazing tool! But it'd be really
> awesome if it maintained targets for games consoles too...
> 

Crosstool-NG is a set of scripts & patches to built gcc cross
compilers. It includes patches for common build problems, a nice GUI to
configure the build and allows to build complicated cross compiler
configurations (like building a toolchain which targets C (e.g. ARM),
runs on B (e.g. Windows) and is compiled on B (e.g. Linux)).

(The important part is that it's maintained and used by many people so
it has patches for most of the problems you can run into. For example I
ran into this problem when building devkitPro:
http://crosstool-ng.org/hg/crosstool-ng/rev/372245834071)

It can also build additional useful tools and libraries (like gdb,
strace, ...)

Integrating D is very easy, here are some instructions:
http://gdcproject.org/wiki/Cross%20Compiler/crosstool-NG


Adding console toolchains might be a little more difficult. Adding the
GCC/binutils patches is simple (just copy them into the right folder),
but you have to be careful making sure that gcc is built with exactly
the same options as the current console toolchain (certainly doable).
I'm not sure how good the newlib support is in crosstool-NG though,
adding rules for newlib might be some extra work. But if I was a
devkitPro developer I'd try to move the toolchain to crosstool-NG as it
really simplifies building cross compilers.


More information about the Digitalmars-d mailing list