[LLVMdev] gcc 4.2 to llvm-gcc 4.2 transition

Chris Lattner clattner at apple.com
Sat Jul 24 11:32:53 PDT 2010

On Jul 24, 2010, at 4:41 AM, Alexandre Colucci wrote:
> I am currently studying the possibility to make the transition from gcc 4.2 to llvm-gcc 4.2 for the projects I am working on.
> These projects are huge projects, most of the source code is written in C++ but we have objc, c and assembly code. We are targeting MacOSX 10.5 and MacOSX 10.6.

Ok, great!

> Our build system is currently running on MacOSX 10.5 and uses Xcode 3.1.4 with gcc 4.2. It is used to generate the release builds we ship and the beta releases. We could possibly switch this machine to 10.6 and Xcode 3.2.x. We still plan to support 10.5 for some time.

Xcode 3.2 running on 10.6 definitely supports building apps for 10.5.

> Switching the compiler to llvm-gcc 4.2 on 10.6 with Xcode 3.2.3 is smooth. By just changing the compiler setting in Xcode, I was basically able to compile the projects with llvm-gcc 4.2 with no major issues. On 10.5 with Xcode 3.1.4, it is a different story. Xcode 3.1.4 contains an old version of llvm-gcc 4.2 which can't build our applications. There are 2 causes of the compilation failure:
> - llvm-gcc 4.2 contained in Xcode 3.1.4 can't compile CodeWarrior or Microsoft inline assembly.
> - llvm-gcc 4.2 contained in Xcode 3.1.4 doesn't recognize some i386 inline assembly instructions ("mov edx,aFloat" where aFloat is a float*).

Right.  llvm-gcc in 3.1.4 is really really ancient and buggy.  I really don't recommend using it.

> These issues prevent us to switch from gcc 4.2 to llvm-gcc 4.2. We could switch our build system to 10.6 but if we have a 10.5 specific issue, we need to be able to compile and debug our code on 10.5 on the developers machines. I would like to avoid to temporary change all the projects to gcc 4.2 on a machine in order to fix a 10.5 issue (and to hope the compiler doesn't change the issue behavior).

Apple fully supports deployment of apps to 10.5 machines when built on 10.6.

> We have right now several possibilities:
> - we don't switch to llvm-gcc 4.2 until we drop 10.5 support. But that could be in 1 or 2 years. At this point we might decide to switch directly to LLVM 2.0 since Xcode 4 will probably be available.


> - we hope that Apple release for 10.5 a new version of Xcode (Xcode 3.1.5) with an updated llvm-gcc 4.2 compiler. I really doubt about it.

Not going to happen, Apple only releases new tools for their current OS's.

> - we find a way to update the llvm-gcc 4.2 version in Xcode 3.1.4. I haven't investigated this point yet. Does anyone know if this is possible at all?

This is definitely possible, but you have to build your own copy of llvm-gcc off llvm.org.  This will give you a configuration that Apple will not support, but it should work fine.

> Does anyone have some recommendations? Is llvm-gcc 4.2 appropriate to use in our case or should we keep using gcc 4.2 for some time?

llvm-gcc (in Xcode 3.2.3 or later) is fully mature, and a heck of a lot less buggy than apple gcc 4.2.  I strongly recommend upgrading to it.


More information about the llvm-dev mailing list