GCC cross-toolchain tutorial for Mac OS X

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

GCC cross-toolchain tutorial for Mac OS X

Post by max »

Hey guys,

I just had to setup a new developer machine running OS X, and took the chance to document what is necessary to build a cross compiler on a plain Mac OS 10.9.

My tutorial might be a little redundant to the "GCC Cross compiler" wiki page, but it's a little shorter, easier, more up to date and specific to OSX. I mostly wrote it so I don't forget how to do it myself :D

http://wiki.osdev.org/User:Max/Building ... _Mavericks

It would be nice if one of you could have a short look if everything is alright - maybe we could even add this page to the current cross compiler tutorial page, if you think this makes sense.

Greets :)
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: GCC cross-toolchain tutorial for Mac OS X

Post by sortie »

Hi Max.

Thanks for your contribution!

Instructions for obscure systems such as OS X and Cygwin are usually hard to write for Linux users such as me (that consider such systems obscure and pretend they don't exist when writing wiki articles (:P).) Joking aside, I'm happy to see freshly confirmed instructions. OS X and clang (LLVM) are fast moving targets and wiki instructions for them tend to get significantly out of date, so any help confirming that the instructions work or whether they don't is useful :-)

You really shouldn't make more permutation articles such as `Building a GCC FOO cross-compiler on BAR version QUX'. The wiki already has a ton of slightly diverging Bare Bones, I don't want the same to happen for cross-compiler tutorials too. I can see your tutorial is mostly the same as the current official cross-compiler tutorial, except for useful homebrew instructions. Tomorrow or something I'll take the unique parts of your tutorial and integrate them into the official cross-compiler tutorial, so we have one central cross-compiler tutorial. Perhaps it is warranted, though, to have special `Getting a real GCC on OS X' and `Installing Cygwin' tutorials with various platform idiosyncrasies to keep the core tutorial simple.

Btw. Use the preview button when you edit an article. You made a lot of small edits which spammed the Recent Changes log. This makes it considerably harder for wiki volunteers to review your work. It is perfectly alright to make a bunch of subsequent edits to an article if you must, but 30 is too much. :-)
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: GCC cross-toolchain tutorial for Mac OS X

Post by max »

Hey sortie,

thanks for the reply! :) Okay, I think integrating would be a good idea. Yeah, I thought that some stuff would be a little redundant, but maybe some parts of it help you updating the cross compiler page ;)
sortie wrote:Btw. Use the preview button when you edit an article. You made a lot of small edits which spammed the Recent Changes log. This makes it considerably harder for wiki volunteers to review your work. It is perfectly alright to make a bunch of subsequent edits to an article if you must, but 30 is too much. :-)
Oooh I'm very sorry, I didn't think about that. I will use that button from now on :>

Greets :)
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: GCC cross-toolchain tutorial for Mac OS X

Post by Owen »

GCC compiles perfectly fine with the version of clang shipped with xcode. There is no reason to build a standard GCC. GCC has poor support for OS X, and use of the shipped libstdc++ library can cause very hard to debug problems.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: GCC cross-toolchain tutorial for Mac OS X

Post by max »

Owen wrote:GCC compiles perfectly fine with the version of clang shipped with xcode. There is no reason to build a standard GCC. GCC has poor support for OS X, and use of the shipped libstdc++ library can cause very hard to debug problems.
Yeah, basically Homebrew also compiles GCC with LLVM. So that shouldn't be a problem. I just find it a little bit more "natural" to build the cross compiler with a real GCC :3
Why libstdc++? I don't mention using libstdc++, I am only telling how to build libgcc for the target system.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: GCC cross-toolchain tutorial for Mac OS X

Post by Owen »

max wrote:
Owen wrote:GCC compiles perfectly fine with the version of clang shipped with xcode. There is no reason to build a standard GCC. GCC has poor support for OS X, and use of the shipped libstdc++ library can cause very hard to debug problems.
Yeah, basically Homebrew also compiles GCC with LLVM. So that shouldn't be a problem. I just find it a little bit more "natural" to build the cross compiler with a real GCC :3
Why libstdc++? I don't mention using libstdc++, I am only telling how to build libgcc for the target system.
If you compile GCC with GCC, you use libstdc++ as the C++ runtime.

The GCC 4.9 libstdc++ can conflict with the system Apple-GCC-4.2 libstdc++'s symbols. This can cause issues.
Post Reply