Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the easiest way to setup full Clang, libc++ and LLVM as default global toolchain? All of my attempts to build it, in most of the configurations I could think of, resulted in working Clang, but it didn't use libc++ headers, but default GCC's libstd++'s ones, resulting in numerous faults in incompatible pieces of library code.

I would like it working out of the box, without having to do magic in .bashrc or passing all those -stdlib=libc++ and -lc++ to compiler and linker.

share|improve this question
up vote 3 down vote accepted

Judging on how LLVM and Clang have been integrated into FreeBSD's base, i think you will need to hack Clang's internals to set library and headers paths (lib/Frontend/InitHeaderSearch.cpp) for your system.

Using libc++ as default definitely needs changing the code (grep lib/Frontend/CompilerInvocation.cpp for "UseLibcxx"). You will probably need to hack system linker too to change -lstdc++ to -lc++.

Personally, i'd recommend you just setting CC, CXX, CFLAGS, CXXFLAGS and other vars to achieve same result without much hassle. It works for me flawlessly on FreeBSD.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.