Thread overview
Building Apple GCC with GDC
Dec 06, 2006
Paolo Invernizzi
Dec 07, 2006
David Friedman
Dec 11, 2006
David Friedman
Dec 12, 2006
David Friedman
December 06, 2006
I'm trying to build Apple's "Universal" gcc-5363,
but somehow it always fails in the install phase ?

gnumake install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' \
		SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
		DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym

I added "d" to the --enable-languages in build_gcc,
otherwise it is using the GCC settings Apple chose.


Tried building GDC 0.19 with gcc-5341 earlier, but
didn't have much luck with that effort either... :(

Downloaded the GCC source code tarball from Apple,
and added the "d" directory and ran "setup-gcc.sh"

http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5363.tar.gz
http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5341.tar.gz


How did you build gdc-0.19-macos-universal.tar.bz2 ?
I would like to build a compiler from GDC SVN trunk.

--anders
December 06, 2006
Actually, a step-by-step process (configure included) of the build process would be very appreciated!

---
Paolo Invernizzi

Anders F Björklund wrote:
> I'm trying to build Apple's "Universal" gcc-5363,
> but somehow it always fails in the install phase ?
> 
> gnumake install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' \
>         SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
>         DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
> 
> I added "d" to the --enable-languages in build_gcc,
> otherwise it is using the GCC settings Apple chose.
> 
> 
> Tried building GDC 0.19 with gcc-5341 earlier, but
> didn't have much luck with that effort either... :(
> 
> Downloaded the GCC source code tarball from Apple,
> and added the "d" directory and ran "setup-gcc.sh"
> 
> http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5363.tar.gz
> http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5341.tar.gz
> 
> 
> How did you build gdc-0.19-macos-universal.tar.bz2 ?
> I would like to build a compiler from GDC SVN trunk.
> 
> --anders
December 07, 2006
Anders F Björklund wrote:
> I'm trying to build Apple's "Universal" gcc-5363,
> but somehow it always fails in the install phase ?
> 
> gnumake install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' \
>         SRCROOT=`pwd` OBJROOT=`pwd`/build/obj \
>         DSTROOT=`pwd`/build/dst SYMROOT=`pwd`/build/sym
> 
> I added "d" to the --enable-languages in build_gcc,
> otherwise it is using the GCC settings Apple chose.
> 
> 
> Tried building GDC 0.19 with gcc-5341 earlier, but
> didn't have much luck with that effort either... :(
> 
> Downloaded the GCC source code tarball from Apple,
> and added the "d" directory and ran "setup-gcc.sh"
> 
> http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5363.tar.gz
> http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-5341.tar.gz
> 
> 
> How did you build gdc-0.19-macos-universal.tar.bz2 ?
> I would like to build a compiler from GDC SVN trunk.
> 
> --anders

I have only done Universal builds with gcc-5341 on MacOS Intel.  The build environment on my G5 seems to be messed up so that I can't make i386 executables.  gcc-5363 fails on x86_64 stuff.  Hopefully, installing Xcode 2.4.1 will fix these problems (downloading now).

Here are the build steps I use:

    src=`pwd`/gcc-5341

    tar xzf .../gcc-5341.tar.gz
    cd $src/gcc
    tar xzf .../gdc-src.tar.gz
    cd $src
    ./gcc/d/setup-gcc.sh
    mkdir -p build/obj build/dst build/sym
    gnumake install RC_OS=macos RC_ARCHS='i386 ppc' TARGETS='i386 ppc' \
	SRCROOT=`pwd` OBJROOT=`pwd`/build/obj DSTROOT=`pwd`/build/dst \
	SYMROOT=`pwd`/build/sym >> build-log 2>&1 \

    # To make the binary package...

    cd $src/build/obj/obj-i686-i686
    $src/gcc/d/package/simple.sh --macos \
	--with-install-root=$src/build/dst

    # The binary packages are left in /tmp

The setup-gcc.sh script will add 'd' to --enable-languages.  If you did this manually, the rest of the patching of build_gcc may have failed... 
 There is a bug in that lets this patch fail, but still says "GDC setup complete."

If you still get errors, please send me a log.

David
December 07, 2006
David Friedman wrote:

> I have only done Universal builds with gcc-5341 on MacOS Intel.  The build environment on my G5 seems to be messed up so that I can't make i386 executables.  gcc-5363 fails on x86_64 stuff.  Hopefully, installing Xcode 2.4.1 will fix these problems (downloading now).

Thanks for the build info, will try it again on the Intel Mac...

> The setup-gcc.sh script will add 'd' to --enable-languages.  If you did this manually, the rest of the patching of build_gcc may have failed... 
>  There is a bug in that lets this patch fail, but still says "GDC setup complete."

Hmm, wonder if I did do that for the Apple build as well as FSF ?

> If you still get errors, please send me a log.

Will do, and I will contribute my gdcmac/gdcwin packaging scripts.
Basically it's the same, just wrapped with PackageMaker / NSIS...

--anders
December 11, 2006
Anders F Björklund wrote:
> David Friedman wrote:
> 
>> I have only done Universal builds with gcc-5341 on MacOS Intel.  The build environment on my G5 seems to be messed up so that I can't make i386 executables.  gcc-5363 fails on x86_64 stuff.  Hopefully, installing Xcode 2.4.1 will fix these problems (downloading now).
> 
> Thanks for the build info, will try it again on the Intel Mac...
> 
>> The setup-gcc.sh script will add 'd' to --enable-languages.  If you did this manually, the rest of the patching of build_gcc may have failed...  There is a bug in that lets this patch fail, but still says "GDC setup complete."
> 
> Hmm, wonder if I did do that for the Apple build as well as FSF ?
> 
>> If you still get errors, please send me a log.
> 
> Will do, and I will contribute my gdcmac/gdcwin packaging scripts.
> Basically it's the same, just wrapped with PackageMaker / NSIS...
> 
> --anders

I have found that the patch and method described at

http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00997.html

allows building on PowerPC.  The resulting compiler will depend on SDK (unless overridden by -isysroot.)

Also, I was able to build with gcc-5363 after installing the latest Xcode (only tried it on Intel.)

David
December 11, 2006
David Friedman wrote:

>> Thanks for the build info, will try it again on the Intel Mac...
>>
> Also, I was able to build with gcc-5363 after installing the latest Xcode (only tried it on Intel.)

Yes, it built just fine now when I tried it again. The patching
for build_gcc failed (against gcc-5363), but fixed it manually.

For now I left the symlink gdc -> gdc-4.0 in the gdcmac archive,
but think I will do it in the PKG post-install script instead...

i.e. only supply gdc-4.0 and gdc-3.3 in the actual archives ?
(and gdmd wrapper too, it will follow whatever "gdc" is using)

Is there a way to relocate libgphobos.a to e.g. gcc folder,
so that you can install both of GCC 3.3 and GCC 4.0 at once ?

Thanks!
--anders

PS.
Scrapping the "10.4-intel" and "universal" gdcmac versions,
it will all go in the same 10.4 PKG/DMG version for GDC 0.20
December 12, 2006
Anders F Björklund wrote:
> David Friedman wrote:
> 
>>> Thanks for the build info, will try it again on the Intel Mac...
>>>
>> Also, I was able to build with gcc-5363 after installing the latest Xcode (only tried it on Intel.)
> 
> Yes, it built just fine now when I tried it again. The patching
> for build_gcc failed (against gcc-5363), but fixed it manually.
> 
> For now I left the symlink gdc -> gdc-4.0 in the gdcmac archive,
> but think I will do it in the PKG post-install script instead...
> 
> i.e. only supply gdc-4.0 and gdc-3.3 in the actual archives ?
> (and gdmd wrapper too, it will follow whatever "gdc" is using)
> 
> Is there a way to relocate libgphobos.a to e.g. gcc folder,
> so that you can install both of GCC 3.3 and GCC 4.0 at once ?
> 
> Thanks!
> --anders
> 
> PS.
> Scrapping the "10.4-intel" and "universal" gdcmac versions,
> it will all go in the same 10.4 PKG/DMG version for GDC 0.20

You can move ligphobos.a and libgphobos.spec to <prefix>/lib/gcc/<target>/<version> (where libgcc.a is).

That said, I am planning to drop support for GCC 3.3 in the next (0.21) release.  When I asked, I didn't get a response from anyone who was actually using it...

David
December 12, 2006
David Friedman wrote:

>> Scrapping the "10.4-intel" and "universal" gdcmac versions,
>> it will all go in the same 10.4 PKG/DMG version for GDC 0.20
> 
> You can move ligphobos.a and libgphobos.spec to <prefix>/lib/gcc/<target>/<version> (where libgcc.a is).

OK, the reason it wasn't working was that I moved it to
the old Apple GCC location instead of the new one I used. <duh>

i.e.
I moved it to /usr/lib/gcc/darwin/3.3/libgphobos.a, but it
was looking in /usr/lib/gcc/powerpc-apple-darwin7/3.3.6...

Works fine now.

> That said, I am planning to drop support for GCC 3.3 in the next (0.21) release.  When I asked, I didn't get a response from anyone who was actually using it...

That should be OK, I am only using GCC 3.3 for my Mac OS X 10.3
builds and am planning to focus on Mac OS X 10.4 and 10.5 next.

And if GDC 0.20 matches DMD 1.0 - then that should be valid for
a while to come, I guess ? Besides, templates are broken anyway.

Using C instead.

--anders
December 12, 2006
>> That said, I am planning to drop support for GCC 3.3 in the next (0.21) release.  When I asked, I didn't get a response from anyone who was actually using it...
> 
> That should be OK, I am only using GCC 3.3 for my Mac OS X 10.3
> builds and am planning to focus on Mac OS X 10.4 and 10.5 next.

Another idea I've been toying around with is supplying a full
GCC collection (i.e. C/C++/D) using GCC 4.0.3, for use with
Mac OS X 10.2/10.3 and Windows/MinGW. Probably easier to do a
vanilla FSF build for those, than using the "system" compiler ?

So for the GDC 0.20 it's going to be GCC 3.3.6 / Apple gdc-5363
for Mac and MinGW GCC 3.4.2-20040916-1/3.4.5-20060117-1 for Win,
but future versions might provide a full build using GCC 4.0.3
or perhaps even GCC 4.1 and 4.2 when GDC starts support those ?

Will probably use /opt/gnu, and include a patched GDB as well...
But it will come after wxD (and Code::Blocks) have been improved.

--anders