Comment 4 for bug 1135519

Revision history for this message
Jack Hale (jack-hale) wrote :

Hi Patrick and Timothee,

To be clear on what I'm running it is the latest Mac OS X Mountain Lion 10.8 with the latest update to XCode with the Command Line Tools installed. I have pressed 'check now' and there is no updates available for XCode or the command line tools. Timothee's install I would guess is probably OS X Lion looking at the dates in uname -a. If he could provide more info on his macports/XCode versions that would be handy.

I also have macports installed with:

jacks-mac-mini:~ jack$ sudo port select --list gcc
Available versions for gcc:
 apple-gcc42
 llvm-gcc42
 mp-gcc45
 mp-gcc47
 none (active)

Available versions for gcc:
 apple-gcc42
 llvm-gcc42
 mp-gcc45
 mp-gcc47
 none (active)

A crucial point is that apple-gcc42 and llvm-gcc42 are different compilers chains. LLVM is the new compiler backend that most of the *BSDs (NetBSD, FreeBSD, OpenBSD etc.) + OS X use, along with clang as the new C++/Objective-C/C front end to LLVM. GCC of course is the compiler chain used on Linux. However, it is also possible to use LLVM as a backend for GCC! Yes, its all very confusing.

My understanding is that apple-gcc42 is Apple's version of GCC, and llvm-gcc42 is Apple's version of GCC with the LLVM backend. Source:
https://trac.macports.org/browser/trunk/dports/lang/apple-gcc42/Portfile
https://trac.macports.org/browser/trunk/dports/lang/llvm-gcc42/Portfile
The clang compilers are a different set of compilers again!

The default compilers on my system are (sudo port select gcc none):

jacks-mac-mini:~ jack$ clang --version
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix

jacks-mac-mini:~ jack$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.

With sudo port select gcc apple-gcc42:

jacks-mac-mini:~ jack$ g++ --version
i686-apple-darwin12-g++-apple-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) (MacPorts apple-gcc42 5666.3_10)
Copyright (C) 2007 Free Software Foundation, Inc.

With sudo port select gcc llvm-gcc42:

jacks-mac-mini:~ jack$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.

I thought at first that Timothee must have option 2 selected, but his version label doesn't seem to be the MacPorts version. Perhaps he could clarify on this.

For what its worth gcc 4.2 (with or without LLVM) is pretty ancient these days. Patrick, I would recommend you work with the MacPorts version of a modern gcc version, perhaps one that matches your version in Ubuntu. You can then specify this as a requirement in the INSTALL file. My 12.04LTS has 4.6 series installed, which has a macports equivalent:

https://trac.macports.org/browser/trunk/dports/lang/gcc46/Portfile

The other option is clang but I noticed you use gccxml, not sure how compatible this is with using the new clang toolchain.

Jack Hale