Page 1 of 1

GCC cross-compiler on mac os

Posted: Fri Feb 03, 2012 8:25 pm
by alaroldai
The GCC cross-compiler page gives advice about building GCC/binutils on mac os, specifically it says to change the default $(CC) from apple's llvm-gcc to gcc-4.2 in /usr/bin.

However, as of Mac OS 10.7 and Xcode 4.2, Apple doesn't seem to provide a 'regular' version of gcc - instead they provide clang and a version of llvm that may (or may not, I haven't checked) be the same as their own, meaning that it might not support cross compilation.

Has anyone had any luck building a GCC cross compiler on mac os with the new tools? I've been having a look at using LLVM to compile my kernel instead of GCC, but so far it's looking a bit messy.

If anyone's found a good toolchain for kernel dev on mac, that might be worth putting on the wiki...

Re: GCC cross-compiler on mac os

Posted: Sat Feb 04, 2012 6:47 am
by turdus
alaroldai wrote:However, as of Mac OS 10.7 and Xcode 4.2, Apple doesn't seem to provide a 'regular' version of gcc
They provide it, it's just not installed by default. You can find the .mpkg on the 2nd DVD of your install DVD set in a subdirectory called Optional.

Code: Select all

imac:~ turdus$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.