Problems with Clang self-building, to use libTooling


Apologies in advance if this is the wrong place to ask this…

tldr: On OS X 10.10, toggled on LLVM_ENABLE_LIBCXX, and now clang can’t build itself because it doesn’t know where the libc++ headers are.

I’m trying to get started using libTooling, primarily via the clang tutorial featuring ASTMatchers[1]. I followed the instructions there, but when I run ccmake, to update CMAKE_CXX_COMPILER after building, I start to run into troubles.

First, after typing ‘c’ to configure, I get an error about missing libstdc++4.7. I toggled on LLVM_ENABLE_LIBCXX as per this thread[2], and this did allow ccmake to configure without errors. But once I ran ninja after this step, the build failed because the libc++ headers could not be found. I am on OS X 10.10, the system libc++ headers are in /usr/include/c++/4.2.1. I tried a few different things to explicitly have the system c++ header directory added to the includes list, but they things I tried did not work.