Assuming this is possible, could someone tell me, how I have to configure the cmake build to create a "pure" llvm toolchain on ubuntu-16.04 consisting of
- clang
- lld
- libc++
- libc++abi
- libunwind (llvm)
- compiler-rt
- any other pieces that might be relevant and are "production ready"
The resulting compiler should
- be as fast as possible (optimizations turned on, no unnecessary asserts or other checks in the compiler binary itself)
- be installed in a separate, local directory (lets call it
<llvm_install>
) - not have dependencies to the llvm tolchain provided by packet manager
- use libc++, libc++abi etc by default.
- support the sanitizers (ubsan, address, memory, thread) (which probably means that I have to compile libc++ a second time)
So far I have cloned
- llvm from
http://llvm.org/git/llvm.git
into<llvm_root>
- clang from
http://llvm.org/git/clang.git
into<llvm_root>/tools/clang
- lld from
http://llvm.org/git/lld.git
into<llvm_root>/tools/lld
- compiler-rt, libcxx, libcxxabi, libunwind from
http://llvm.org/git/<project_name>
into<llvm_root>/projects/<project_name>
Then run ccmake in a separate directory - I have tried various settings, but as soon as I try anything more fancy beyond turning optimizations on, I almost always get some sort of build error. Unfortunately, I have yet to find a way to export my changes from ccmake otherwise I'd give you an example with the settings and according error, but I'm more interested in a best practice than a fix to my test configs anyway.
Bonus points: By default, this should build with the default g++ toolchain, but I'd also be interested in a two stage build if that improves the performance of the final toolchain (e.g. by using LTO).
Btw.: The whole Idea came from watching chandler's talk
Pacific++ 2017: Chandler Carruth "LLVM: A Modern, Open C++ Toolchain"