Compiling GDC for devkitARM r20

As promised before, I am going to post instructions for getting GDC 0.22 to compile as part of devkitARM r20…

What you will need:

binutils-2.17.tar.bz2, gcc-core-4.1.1.tar.bz2, gcc-g++-4.1.1.tar.bz2, gdc-0.22-src.bz2 and newlib-1.15.0.tar.gz

Also, you will need to devkitARM r20 build scripts. I suggest you obtain the latest ones via the DKP SourceForge cvs…

Instructions:

1: Create a work directory and extract each file to it

2: Move the d folder and place it under gcc-4.1.1/gcc (So the path to it is: $(YOURFOLDER)/gcc-4.1.1/gcc/d)

3:  Go to the gcc-4.1.1/gcc/d and do the following:

*: Open Make-lang.in and search for D_GLUE_OBJS. Add prefix.o to the end of the list of objects. The object before it should be d/dt.glue.o. Save your changes.

*: Open setup-gcc.sh and comment out the line ”ln -s gcc/d/phobos libphobos || exit 1 ” and then comment out the line “patch -p1 < gcc/d/patch-toplev-${gcc_ver}.x || exit 1″. Save your changes.

4: Download the DKP Build Script  and extract the shell script in it to your work folder.

5: Edit the shell script, changing the –prefix=/home/adam/development/dkp entries to reflect the location of your own work directory. Save changes.

6: Run the shell script.

7: Let me know if you encounter any errors…

I have tested the above script using Mandriva 2007 and it worked fine. It should work find with MSys under Windows, but I have

yet to test this for myself.

EDIT: An update on the above…

5: Edit the shell script, changing the /home/adam/development/dkp entries to reflect the location of your own work directory. Save changes.

In other words, change all refs to the homepath, not just the –prefix one…

Finally, before things will work right, you will need to make sure the output directory ($(YOURDIR)/output/bin) is on your path in order to allow access to the compilers during compiliation…

EDIT:

Compilation seems to fail under OpenSuse 10.2, which uses GCC-4.1.2. I’m not quite sure why this is happening yet…

EDIT :

Worked out the above problem. The file dkp.sh, change ./gcc/d/setup-gcc.sh to sh ./gcc/d/setup-gcc.sh. This makes sure that the

GDMD patch script gets run. Also, at the moment I’m testing out GDC 0.23. Seems to be working fine, although the prefix.o patch to Make-lang.in is still necessary.

EDIT:

Yet another belated update. Some testing has revealed that the process outline above may produce faulty versions of the standard libraries used by various C applications, which in turn prevents them from compiling. The error in question looks like this:

linking gen_config.elf

/mnt/store2/Mandriva_BK/development/newdevkitPro/devkitARM/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib/ds_arm9_crt0.o: In function `CIDLoop’:

ds_arm9_crt0.s:(.init+0×210): undefined reference to `__libc_init_array’

collect2: ld returned 1 exit status

make[1]: *** [/mnt/store2/Mandriva_BK/development/newdevkitPro/projects/gen_config/gen_config.elf] Error 1

make: *** [build] Error 2

A temporary fix for this involves copying the relevant C/C++ libraries from a working devkitARM r20 install. I’ll be looking into this problem to try and work out why the compile process is producing b0rked libraries…

6 Responses to 'Compiling GDC for devkitARM r20'

  1. My Useless Rants » Blog Archive » D on GBA/NDS Progress, Thanks to OOPMan Says:

    […] I was able to use OOPMan’s instructions to successfully build native Windows binaries of GDC+DevKitARM (again, minus standard D libraries) […]

  2. abscissa Says:

    Great job! I’ve used these instructions to successfully build GCC 4.1.2/GDC 0.23/DKA r20 on Windows under MSYS/MinGW:

    http://blog.dev-scene.com/abscissa/2007/04/02/d-on-gbands-progress-thanks-to-oopman/

  3. abscissa Says:

    Wow, I don’t know what happened to my comment there. Seemed to get all…weird.

  4. oopman Says:

    The blogs here at Dev-Scene seem a little stupid WRT to comments…

  5. flyingsquirrl Says:

    This is very exciting. I’m going to give this a whirl tonight on either OS X, or Linux, or both.

  6. flyingsquirrl Says:

    Hmmm… comment vanished again. Anyway, this is awesome and I’m definitely going to check it out!

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>