Any details I should know before trying to build on OS X Snow Leopard (Darwin 10) ?

Hi,

One of my Macs is kept at 10.6.8 (with Xcode 3.2.6) because it's a
system I still wish to support. However, I'd like to move to clang on
it, if possible. I prefer to either install a precompiled binary
distribution (if it exists) or compile it on my own, but for the
moment I'd prefer to avoid installing it through macports.

Looking at the LLVM releases downloads page, I see several downloads
tagged "Darwin", but it doesn't specify what Darwin version is
required for it to run (some of them say "Darwin 10.9", but is it
Darwin 10.9 or OS X 10.9? On very older releases (the gcc front-end
ones) I see Darwin10 binaries.

I suppose there won't be any relatively recent binary distribution
that I can use on Snow Leopard, so I guess I've to build it myself. In
that case, should the 3.8.0 build out of the box? If not, is there any
not too old release that would build out of the box? (when I say "out
of the box", I mean that it passes all tests, and no custom patches
are necessary).

Thanks a lot in advance,

I’m not aware of any difficulty with an older OS such as 10.6.8 as such, but there is a pretty fundamental thing that recent Clang/LLVM source code uses features from C++11, which the existing compiler on a 10.6.8 machine won’t support.

Clang 3.4 supports C++11, but does not require it.
Clang 3.5 and later requires a C++11 compiler.

A quick internet search suggests that you can build Clang 3.4 with the system compiler on 10.6.8.

Once you have a working Clang 3.4 you can build later Clang versions. I’m not 100% sure whether 3.4 implements C++11 sufficiently bug free to compile Clang 3.8.

You could also of course look at installing/building a more recent gcc to build recent Clang with. Gcc 4.9 is the first version that does not label C++11 support as experimental.

[...]

Once you have a working Clang 3.4 you can build later Clang versions. I'm
not 100% sure whether 3.4 implements C++11 sufficiently bug free to compile
Clang 3.8.

Thanks a lot, Bruce. Yes, I got 3.4.2 working, although it wasn't
easy. I had to cross-compile from a OS X 10.11 machine back to 10.6,
because the default gcc 4.2 in 10.6.8 wouldn't build llvm 3.4.2. Then
I ran the test suite on 10.6.8 and it passed successfully.

However, building llvm 3.8.0 on OS X 10.6.8 is quite a different
story, even if you have a working 3.4.2 installation. It seems
development is done always in cutting-edge OS versions. But I don't
surrender, I'm fighting to get it working.

Thanks!