Getting gdc working with xcode 3.1

ylixir ylixir at gmail.com
Fri Sep 19 08:51:17 PDT 2008


Yeah, what I wound up with was two sets of binaries, both universal 
binaries, one targeting intel and one targeting ppc.

i would reccomend going to the site linked in my original post and doing 
steps two and three, that will give you a patched linker and a destroot 
directory structure with the whole works in it that you can make a 
package out of, without impacting your system as a whole.

if you don't want to do that, the gist of what i did is below, but if 
you have specific problems let me know.  worst case i can zip up my 
destroot and e-mail it, or upload it to my google site for a few days so 
you can download.

you can get all my patches and scripts from the link in the original 
post, you'll need the one for the linker and for the actual compiler, 
unless you already made your own which maybe you did if you already have 
the ppc->ppc part working. i also modified dave cheney's script that 
basically automates the whole build/patch process for the compiler, 
again, see the page linked above.

basically what i did was patch and replace my linker (ld64) before 
anything else, to avoid those nasty bus errors that keep cropping up. 
note that ld64 is symlinked to ld, so replacing ld replaces both.

next step is patching the patches that gdc applies to apples compiler. 
then using the setup-gcc.sh script (more info in the INSTALL file from 
dgcc).

from there i stopped paying attention to dgcc's instructions and 
switched to the instructions in the README.Apple file that comes with 
apples gcc source.

Building the apple way is pretty easy, and does all the dirty work for 
you, no lipo etc. all you do is make a destination, object, and symlink 
directory, then execute the build command. here is the command line from 
my script:

sudo gnumake install RC_OS=macos \
	SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
	DSTROOT=$DESTROOT SYMROOT=`pwd`/build/sym

this command should by default build host and target compilers for both 
platforms, and install them to the place pointed to by DSTROOT. then you 
can ditto it like i did to install on your system, or make a package 
from it, or whatever.

p.s. i had to use sudo because apple automatically makes root the owner 
of all the executables and stuff.

p.p.s. if you don't use the script to build the compiler, it's still a 
good reference on how to apply the patches, and how to run the build

Michel Fortin wrote:
> On 2008-09-18 04:38:49 -0400, Anders F Björklund <afb at algonet.se> said:
> 
>> Thanks for the update, I'm still planning to make a
>> release of "gdcmac" for Leopard and might as well aim
>> for Xcode 3.1 and gcc-5484 instead of 3.0 and gcc-5465.
>>
>> Or maybe stick with the original "plan" and go straight
>> for gcc_42 instead, for the fictional GDC 0.25 release ?
>> Along with upgrading MinGW's GCC to 4.2.1, for "gdcwin"...
> 
> Anything that runs out of the box with no show stopper is an improvement 
> from what we have now.
> 
> I've been trying too to build a working GDC with the intent of creating 
> a D for Xcode package including the compiler, debugger, linker and my D 
> for Xcode plugin with some project and file templates all together for 
> easy installation. I want to distribute a universal binary compiler 
> capable of PowerPC and Intel output, but I haven't had much success in 
> compiling it up to now.
> 
> My current approach is to compile four compilers (PowerPC to PowerPC, 
> PowerPC to Intel, Intel to Intel, and Intel to PowerPC) and merge 
> executables into universal binaries using lipo. But I haven't been able 
> to compile anything but the first variant (PowerPC to PowerPC). Do you 
> have any tip for doing the rest, as you seem to have acheived it somehow 
> for gdcmac?
> 


More information about the D.gnu mailing list