What is D?
What is GDC(mac)? It's been over a year since an official gdc version has been released, since then Leopard, or Mac OS 10.5 has been released. Since the native compiler for Leopard is incompatible with the released version of gdc, and since compiling your own can be a pain, I'm providing this guide, which will give you step by step instructions on how to install a native version of gdc on leopard that is compatible with the latest version of Xcode as of today. Note: As of gdc svn 243 and apple gcc build 5484 these instructions seem to be working for me. This is barely tested, and will probably break your toolchain, and maybe start your system on fire, so don't blame me if something goes wrong (but let me know, so i can change the instructions here). Step 1Install Xcode 3.1. You can download it from here. These instructions and patches and scripts install Apple's gcc build 5484, which comes with xcode 3.1 only, if you use a different version of xcode, i don't know what will happen. Anyhow, it's a big download, so use a reliable connection.Step 2Patch the linker. for whatever reason the linker that comes with xcode 3.0 and xcode 3.1 dies a horrible death when it tries to put d code together for powerpc machines, so you will need to patch your linker. or you can be a dick and leave all those poor people with ibooks who can't afford to upgrade out in the cold.First you need to download the source of the linker. It is available here. Unzip the ld64-85.tar.gz file. Now download the ld64-85-ppc-fix.patch file i have attached below to the ld64-85 folder that was just created. Open the Terminal. if you don't know how, just use spotlight to find it. type in the following commands:
cd location_of_ld64-85_folderOkay, if you didn't get any errors patching, then fire up xcode and open the ld64.xcodeproj. Change the active configuration to release, and build it (command-B). Once your build is finished, then go back to the terminal and enter the following commands (note that sudo will ask for your password):
cd /usr/bin
Don't forget the period at the end of the last command. Okay, now that we have a fixed up linker lets move on. Step 3This is the part where we are actually going to build the new version of gcc that is capable of compiling d code. First download gdc5484.patch and makegdc.sh to an empty directory. If the links don't work, they are attached below. For simplicity we will call the directory where these files are "gcc_folder". The patch and script are working for me as of svn version 243 for gdc, but things may change, and if i don't get around to updating this page you may have to tweak the patch and/or the script.Again turn to your terminal and run the following commands.
cd gcc_folder
And wait. You might have to put in your password at some point here. The script should download and patch and compile everything for you, if it has trouble downloading the gcc source, then get it here and put it in "gcc_folder/src" and run the script again. If everything went like it should then the makefile should have installed your compilers to "gcc_folder/destroot". If you are worried about your system still working, then you can simply use the compilers from there. It might take a fair bit of tweaking to get all your paths set up and whatnot though. If you want better integration with the system then continue on.... Step 4This is part that has a great chance of hosing your system if anything went wrong, or if any incompatibilities were introduced by our mucking around. That being said, it's the point of this page to do this so....yep....go to your terminal and do the following to install the compiler onto your system.
sudo ditto gcc-folder/destroot /
Tada! Welcome to the wonderful world of D. Now write a program and you can compile with "gdc hello.d" or "gdmd hello.d" etc. CreditsBasically nothing on this page has been done first by me, this is just me hoping to collate and update the work that people much smarter than myself have done, so I would like to point out some places that i got my information from.Dave Cheney's script to build gdc trunk against apple gcc-5465 on leopard Anders F Björklund's most everything else, from all the gdcmac stuff to figuring out how to patch the linker. The d newsgroups in general. The people that i forgot to mention. |