sunny2016 sunny2016 -4 years ago 165
C Question

How to build clang with clang?

I allready build clang(3.2) with MSVC and MinGW succesfully. But I think it's not the "purely" clang. So could someone give me some instructions or materials about how to use clang to build clang(Windows/Linux)? And could we use clang indepently(Not depent on GCC or MSVC). Thanks all!

Answer Source

Well get an older version of clang like 3.1. (You can pretty much install any version that comes precompiled for your OS)

Get the sources for a newer version like 3.2.

Then (i like cmake+ninja (

if you unpacked llvm source to ~/llvm_source/llvm

cd ~/llvm_source
mkdir build
cd build
CXX=clang++ CC=clang cmake -G Ninja ../llvm -DCMAKE_BUILD_TYPE=Release

If you want it for make

CXX=clang++ CC=clang cmake ../llvm -DCMAKE_BUILD_TYPE=Release

Thats it.

Have fun.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download