Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Use Gentoo Distcc Host to cross-compile for OSX
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
xadium
n00b
n00b


Joined: 09 Jan 2004
Posts: 14
Location: UK

PostPosted: Sun Apr 04, 2004 1:50 pm    Post subject: HOWTO: Use Gentoo Distcc Host to cross-compile for OSX Reply with quote

HOWTO: Use Gentoo Distcc Host to cross-compile for OSX

Pre-amble
Having recently discovered the wonders of distcc and seeing the recently announced release of OpenOffice.org for OSX I decided I'd look into using my Gentoo box to compile for my slightly underpowered G3 700Mhz iBook running OSX 10.3 Panther. Looking around the forums there were a number of posts for compiling for Linux on PPC and using distcc in that way but I couldn't find anything specifically to compile Mach-o Darwin binaries under Gentoo. Before I go any further I should say a huge thank you to Dara Hazeghi whose homepage can be found here - I emailed him regarding the instructions on his website which were instrumental in working out which tools I needed and the script that was used to create the toolchain. The credit is primarily his and any mistakes are more than likely mine! He kindly gave me permission to reproduce the steps I followed to build the cross compiler.

1. Creating the toolchain
There is an ebuild (crossdev) for creating toolchains for other architectures running Linux, as we're using a different architecture and a different OS this can't be used. Instead you'll need to equip yourself with some Darwin-specific stuff. You will need:

Once you have everything downloaded into a directory you'll need to edit the top section of shortbuild.sh to suit you: SRCDIR is where you've placed the downloaded files, PREFIX is where we want the toolchain to end up and TARGET needs to reflect the system type of the target system.
Code:
SRCDIR=/home/ali/crossdev
PREFIX=/home/crossdev/darwin
CCTOOLSVERSION=495
CCTOOLS=cctools-$CCTOOLSVERSION.tar.gz
BISON=bison-1.28.tar.gz
GCCVERSION=1495
GCC=gcc-$GCCVERSION.tar.gz
TARGET=powerpc-apple-darwin7.3.0

Execute shortbuild.sh and cross your fingers - at the end you should have a toolchain in PREFIX containing an assembler and the gcc tools!

2. Using distcc
I personally already have distcc running on my Gentoo box to compile x86 software for my brother's laptop and my server. I've set my machine up to run a parallel version of distcc for building the Darwin binaries. I:

  1. Copied the existing /etc/conf.d/distccd to /etc/conf.d/distccd-ppc and /etc/init.d/distccd to /etc/init.d/distccd-ppc
  2. Edited /etc/conf.d/distccd-ppc so that distccd would run on a different port, use an alternative pid file and contained the PATH to PREFIX/bin and PREFIX/TARGET/bin
    Code:
    /etc/conf.d/distccd-ppc
    # Copyright 2003 Gentoo Technologies, Inc
    # $Header: /home/cvsroot/gentoo-x86/sys-devel/distcc/files/2.11.1p/conf,v 1.2 2004/03/02 17:23:01 lisa Exp $
    # distccd configuration file

    # this is the distccd executable
    DISTCCD_EXEC=/usr/bin/distccd
    # this is where distccd will store its pid file
    DISTCCD_PIDFILE=/var/run/distccd/distccd-ppc.pid
    # set this option to run distccd with extra parameters
    # Default port is 3632.  For most people the default is okay.
    DISTCCD_OPTS="--port 3633"
    # set this for niceness
    # Default is 15
    DISTCCD_NICE="15"
    DISTCCD_PATH="/home/crossdev/darwin/bin:/home/crossdev/darwin/powerpc-apple-darwin7.3.0/bin:${PATH}"
    DISTCCD_LOG="/var/log/distccd.log"

  3. Unfortunately the init script for distccd doesn't pay any attention to the DISTCCD_PATH variable, instead using gcc to establish its own path. I edited my /etc/init.d/distccd-ppc so that it would use the path specified above. Find the line in start() that begins PATH and change it as below:
    Code:
    #!/sbin/runscript
    # $Header: /home/cvsroot/gentoo-x86/sys-devel/distcc/files/2.11.1p/init,v 1.2 2004/03/02 17:23:01 lisa Exp $

    depend() {
            need net
    }

    start() {
            rm -f ${DISTCCD_PIDFILE}
            ebegin "Starting distccd"
            PATH="${DISTCCD_PATH}" \
            /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
            --pidfile ${DISTCCD_PIDFILE} -- \
            --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \
            ${DISTCCD_OPTS}

            eend $?
    }

    stop() {
            ebegin "Stopping distccd"
            start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
            rm -f "${DISTCCD_PIDFILE}"
            eend $?
    }

  4. That's it! Add distccd-ppc to your default runlevel if you so wish and/or issue a
    Code:
    /etc/init.d/distccd-ppc start
    and you should be away!

3. Setting up the Mac
I won't go into the details of setting up Fink on your Mac as this is a Gentoo forum, for more information head over to the Fink homepage. Do the following:

  1. Install Fink
  2. Set Fink up to use unstable sources
  3. Run:
    Code:
    fink selfupdate; fink index
    fink install distcc-default

  4. Link /sw/bin/gcc, /sw/bin/c++ and /sw/bin/g++ to /sw/bin/distcc and delete /sw/bin/cc.
  5. Edit /sw/etc/distcc.conf to include your Gentoo box running distcc
  6. Try and compile something and see what happens!


This is my first attempt at attempting to document something on here so if anything is incorrect with the layout or something then I apologise. If there's anything that doesn't make sense or could be made clearer then feel free to let me know. I'd like to say thanks again to Dara, he's the genius behind the process and it's down to him that I managed to get it working! If you want anymore help with the Fink aspect I intend to put the guide up on my website with that section expanded but am more than happy to respond to a PM or IM.

Ali
Back to top
View user's profile Send private message
NewBlackDak
Guru
Guru


Joined: 02 Nov 2003
Posts: 512
Location: Utah County, UT

PostPosted: Sun Apr 04, 2004 10:05 pm    Post subject: Reply with quote

Kewl. I've been trying to setup my sun boxes to compile OS X code for awhile. They already compile x86 Linux, and PPC Linux code. I wasn't even thinking about Apple's cctools. I'll see if I can install it on sparc, and if it needs a patch or not.
_________________
Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy
Back to top
View user's profile Send private message
Hes Nikke
n00b
n00b


Joined: 07 Jun 2003
Posts: 14

PostPosted: Fri Apr 23, 2004 4:39 am    Post subject: XCode Reply with quote

if you can get this working with XCode and cocoa, i will personally kiss you! :lol:

(i hope apple make an announcement about cross platform build farms at WWDC!)
Back to top
View user's profile Send private message
kare
n00b
n00b


Joined: 06 Jun 2004
Posts: 26
Location: Friedberg, Germany

PostPosted: Wed Jun 23, 2004 3:42 pm    Post subject: Reply with quote

Can you please tell me which version of gcc you used creating the toolchain.
I've tried to build it with no success on a gentoo box version 1.4.16.
Back to top
View user's profile Send private message
servobf
Apprentice
Apprentice


Joined: 03 Jun 2004
Posts: 160

PostPosted: Fri Jul 16, 2004 10:22 pm    Post subject: How about vice-versa? Reply with quote

I've got my 800MHz iBook running Gentoo, and my wife has a 1.25GHz iMac running OS 10.3.

I'd like to be able to also compile things for my gentoo box with the help of the iMac.

Is this possible? Dificult?

Thanks,
Michael
Back to top
View user's profile Send private message
stonent
Veteran
Veteran


Joined: 07 Aug 2003
Posts: 1139
Location: Texas

PostPosted: Sat Jul 24, 2004 8:33 pm    Post subject: Reply with quote

What is $TOOLDIR supposed to be? It doesn't apear to be set in your script.

Edit: oops found it.
_________________
Inspiron 4100 & Sun UltraAXe
Portage on Solaris|Dell Laptop Hacks
The way you feel about organized religion is the same way I feel about organized socialism.


Last edited by stonent on Sat Jul 24, 2004 9:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
stonent
Veteran
Veteran


Joined: 07 Aug 2003
Posts: 1139
Location: Texas

PostPosted: Sat Jul 24, 2004 9:15 pm    Post subject: Reply with quote

Code:
make[2]: Entering directory `/mnt/sda6/darwin/objdir/libiberty/testsuite'
make[2]: Nothing to be done for `install'.
make[2]: Leaving directory `/mnt/sda6/darwin/objdir/libiberty/testsuite'
make[1]: Leaving directory `/mnt/sda6/darwin/objdir/libiberty'
make: Target `install' not remade because of errors.


The only thing in the bin directory is "as" the others are dead links to non existant files.
_________________
Inspiron 4100 & Sun UltraAXe
Portage on Solaris|Dell Laptop Hacks
The way you feel about organized religion is the same way I feel about organized socialism.
Back to top
View user's profile Send private message
pvdabeel
Retired Dev
Retired Dev


Joined: 25 Mar 2003
Posts: 188
Location: Belgium

PostPosted: Sat Nov 27, 2004 10:09 pm    Post subject: Reply with quote

The 2004.3 ppc universal livecd (not the mini) has a powerpc-apple-darwin cross compiler on board. The livecd is also distcc enabled.

The cross compiler can compile C, C++, objC and objC++ applications for the Mac OS X / Darwin platform.

Best regards,

Pieter Van den Abeele
Back to top
View user's profile Send private message
assembler
n00b
n00b


Joined: 09 Jan 2005
Posts: 1

PostPosted: Sun Jan 09, 2005 6:14 pm    Post subject: Reply with quote

I get the following error as well, after trying to build on both Debian Woody (with GCC 2.95.4) and on Debian Sid (gcc (GCC) 3.3.5 (Debian 1:3.3.5-5)).

Code:
make[2]: Entering directory `/home/build/crossdev/objdir/libiberty/testsuite'
make[2]: Nothing to be done for `install'.
make[2]: Leaving directory `/home/build/crossdev/objdir/libiberty/testsuite'
make[1]: Leaving directory `/home/build/crossdev/objdir/libiberty'
make: Target `install' not remade because of errors.


Any ideas? I'd love to get this to work.. (and yes, I know this is a Gentoo linux forum, but I thought I might as well try).

Asm
Back to top
View user's profile Send private message
uncleben
n00b
n00b


Joined: 21 May 2004
Posts: 23

PostPosted: Thu Jan 13, 2005 5:01 pm    Post subject: Reply with quote

i get the same error when building. But this error is due to an error long before, there goes something wrong when doing gcc make all.

Can i use this toolchain to develop graphical OSX software.. for example with wxWidgets?
Cocoa is not possible?
Back to top
View user's profile Send private message
line72
Apprentice
Apprentice


Joined: 13 Jun 2002
Posts: 212

PostPosted: Mon Apr 04, 2005 2:51 pm    Post subject: Reply with quote

I'm getting this same error. I also tried every different version of gcc on apple's site, and they all fail to build (with different errors). Has anyone been successful?
Back to top
View user's profile Send private message
Immortal Q
Apprentice
Apprentice


Joined: 14 Sep 2003
Posts: 241
Location: Silicone Valley

PostPosted: Sat May 07, 2005 6:27 am    Post subject: Reply with quote

I'd like to get this going with the current version of the toolchain (Tiger/Darwin 8) but I can't figure out where those include files came from in these instructions. I'll sniff around and see what I can find, in any case. Maybe the folks who put together the cross-compiler for the LiveCD can provide their methods, if they aren't too catalyst-specific? (I know nothing of catalyst, so forgive my ignorance)
_________________
Osmos.org
Now with 20% fewer rabid primates.
Back to top
View user's profile Send private message
Oxidative
n00b
n00b


Joined: 25 Jun 2003
Posts: 33

PostPosted: Wed Nov 16, 2005 11:29 pm    Post subject: Reply with quote

Same problem here. Any news on this? I'd really prefere to build my code on my linux box instead of a slow pearpc emulation. :P
_________________
wormux ebuild: https://bugs.gentoo.org/show_bug.cgi?id=52679
Back to top
View user's profile Send private message
syamajala
n00b
n00b


Joined: 17 Jul 2003
Posts: 52

PostPosted: Sun Jan 29, 2006 7:54 pm    Post subject: Reply with quote

anyone get this to work with the new stuff from tiger? i haven't tried with gcc4 and the new cctools yet, but i would love to use this on my amd64 systems.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum