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
-lc++ to compiler and linker.
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
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.