Successful linux cross-compiling under Leopard

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Nick Carlson
Posts: 18
Joined: Fri Feb 29, 2008 6:08 pm

Successful linux cross-compiling under Leopard

Post 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
iammisc
Member
Member
Posts: 269
Joined: Thu Nov 09, 2006 6:23 pm

Re: Successful linux cross-compiling under Leopard

Post 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.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Successful linux cross-compiling under Leopard

Post 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"...
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Successful linux cross-compiling under Leopard

Post 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. :)
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: Successful linux cross-compiling under Leopard

Post 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.
User avatar
Nick Carlson
Posts: 18
Joined: Fri Feb 29, 2008 6:08 pm

Re: Successful linux cross-compiling under Leopard

Post by Nick Carlson »

Thanks for the tips.

Btw, I'm running OSx86. :twisted:
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Successful linux cross-compiling under Leopard

Post 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.
Attachments
mkcross-dev.sh.zip
SH Script to cross compile binutils 2.18 and gcc 4.2.4
(2.67 KiB) Downloaded 49 times
User avatar
Nick Carlson
Posts: 18
Joined: Fri Feb 29, 2008 6:08 pm

Re: Successful linux cross-compiling under Leopard

Post 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.)
blackcatcoder
Member
Member
Posts: 132
Joined: Wed Nov 03, 2004 12:00 am
Location: Austria
Contact:

Re: Successful linux cross-compiling under Leopard

Post by blackcatcoder »

Also compiled gcc and other stuff on Mac OSx 10.5.4(AMD hackintosh) with ease.
Post Reply