Page 1 of 1

Successful linux cross-compiling under Leopard

Posted: Sun Jul 06, 2008 11:58 pm
by Nick Carlson
After much searching I finally found a cross compiler for osx. It's a bit dated (gcc 4.1.1), but it'll do for now. So now I get to use mac's über sexy development environment. Pics below.

Textmate
Textmate
Textmate
Q, a qemu port to osx.
Q - qemu port
Q - qemu port

Re: Successful linux cross-compiling under Leopard

Posted: Mon Jul 07, 2008 4:25 pm
by iammisc
After much searching I finally found a cross compiler for osx.
Why don't you just compile it yourself. Mac OS X is a complete UNIX system, right? Then gcc should compile fine on it.

Re: Successful linux cross-compiling under Leopard

Posted: Mon Jul 07, 2008 6:22 pm
by pcmattman
iammisc wrote:
After much searching I finally found a cross compiler for osx.
Why don't you just compile it yourself. Mac OS X is a complete UNIX system, right? Then gcc should compile fine on it.
Actually, due to several protection features of OSX it's extremely difficult to compile a cross-compiler. At least, "apparently"...

Re: Successful linux cross-compiling under Leopard

Posted: Mon Jul 07, 2008 6:42 pm
by quok
pcmattman wrote: Actually, due to several protection features of OSX it's extremely difficult to compile a cross-compiler. At least, "apparently"...
Actually it's VERY easy. Just follow the GCC Cross Compiler tutorial on the wiki. I've done it successfully with binutils 2.18 and gcc 4.2.4. I even wrote a script to download sources, apply patches (to enable a target for my OS), and compile the whole thing. The script is written in shell, and works on Mac OS X, Linux, OpenBSD, and Cygwin. I'll post that if anyone is interested.

Btw, I prefer Smultron to Textmate. :)

Re: Successful linux cross-compiling under Leopard

Posted: Tue Jul 08, 2008 12:20 am
by thomasloven
The big problem, as I see it, lies in getting the X-code-package which you need to compile gcc.
It's supposed to be on the OSX dvds, but (at least on my Swedish version of 10.5) it isn't.

Downloading it off the apple developer site is way more complicated than it should be and you get a GB or two of c... stuff you'd never use anyway with it.

BTW. I'm interested in that script.

Re: Successful linux cross-compiling under Leopard

Posted: Tue Jul 08, 2008 12:40 am
by Nick Carlson
Thanks for the tips.

Btw, I'm running OSx86. :twisted:

Re: Successful linux cross-compiling under Leopard

Posted: Tue Jul 08, 2008 8:48 am
by quok
thomasloven wrote:The big problem, as I see it, lies in getting the X-code-package which you need to compile gcc.
It's supposed to be on the OSX dvds, but (at least on my Swedish version of 10.5) it isn't.

Downloading it off the apple developer site is way more complicated than it should be and you get a GB or two of c... stuff you'd never use anyway with it.

BTW. I'm interested in that script.
I never thought of the Xcode package not being on the OSX dvds, or about those guys running OSx86.

I tried writing this script in pure sh, for the people I know that run OpenBSD (where /bin/sh is /bin/pdksh), but in the end I gave up and just switched it to /bin/bash. All my machines have bash as /bin/sh and I'm too lazy to install an OpenBSD VM anywhere to test this, so just run it with bash. :)

The script isn't perfect by any means, so I'd gladly take any patches to it. Right now it only compiles binutils 2.18 and gcc 4.2.4. The gcc it compiles is a naked compiler, so should be perfect for your OSDev desires.

If anyone is interested, I'd be willing to just host precompiled binaries for OS X cross compilers as well.

Re: Successful linux cross-compiling under Leopard

Posted: Wed Jul 30, 2008 12:07 am
by Nick Carlson
Sorry for the late reply. I just wanted to add that I cross-compiled gcc 4.2.2 on osx 10.5.3 with relative ease using instructions from the wiki. (In case anyone else is thinking of doing the same.)

Re: Successful linux cross-compiling under Leopard

Posted: Wed Jul 30, 2008 11:37 pm
by blackcatcoder
Also compiled gcc and other stuff on Mac OSx 10.5.4(AMD hackintosh) with ease.