How to build libc++ with LLVM/Clang 3.3 on Mac OS X 10.6 "Snow Leopard"

I have successfully built and installed LLVM and Clang 3.3 on OS X 10.6.8 “Snow Leopard”. Then I tried to compile libc++ with my new clang++ but could not figure out the right settings: none of the options listed on the page http://libcxx.llvm.org/ work, usually some header is missing. Which is no wonder as these hints are for Linux only.

I googled until my fingers bled :slight_smile: but could find only instructions on how to compile libc++ for OS X 10.7 Lion or 10.8 “Mountain Lion”. For the latter it is not even necessary as Apple ships the full LLVM/clang++/libc++ toolchain there with XCode 5.0. However, on 10.6 one gets only XCode 4.2.

I know that the simplest solution would be to upgrade to OS X 10.8 but for certain reasons that would take too long to explain (has to do something with my workplace) I cannot do this.

Could someone please help me by sending me a short description of how to compile libc++ with clang++ V3.3 on Snow Leopard? Private mail would be appreciated.

Thanks in advance,
Laryx
laryx dot decidua at gmail + the obvious com suffix

  • Marc

Hi there,

Could someone please help me by sending me a short description of how to
compile libc++ with clang++ V3.3 on Snow Leopard? Private mail would be
appreciated.

I usually get it to compile with

    $ export TRIPLE=-apple-
    $ export MACOSX_DEPLOYMENT_TARGET=10.6
    $ ./buildit

Does this work for you?

Cheers,
Benjamin Kircher

Hi Ben,

Thank you for your advice. This was the first I tried – and unfortunately it does not work. Here is the output:

[…]

  • clang++ -c -g -Os -arch i386 -arch x86_64 -std=c++0x -U__STRICT_ANSI__ -nostdinc++ -I…/include …/src/exception.cpp
    …/src/exception.cpp:18:12: fatal error: ‘cxxabi.h’ file not found
    #include <cxxabi.h>

Indeed, there is no cxxabi.h file in the …/include directory :frowning:

Cheers, Laryx