wiki:BuildingClang
Last modified 7 years ago Last modified on 04/18/2012 10:33:13 AM

Building with clang on Linux

clang is a new, modern, C/C++ compiler. It promises to be faster than GCC, and produce more useful error messages.

Building clang from source

This will download and build clang 3.0 in $HOME/clang/3.0

# installing clang 3.0 from source:
curl http://llvm.org/releases/3.0/llvm-3.0.tar.gz | tar xzf -
cd llvm-3.0.src/tools
curl http://llvm.org/releases/3.0/clang-3.0.tar.gz | tar xzf -
mv clang-3.0.src clang
cd ..
./configure --prefix=$HOME/clang/3.0
export NCORES=$((sysctl -n hw.NCORES || (test -r /proc/cpuinfo && grep processor /proc/cpuinfo | wc -l) || echo 2) 2>/dev/null)
export MAKEFLAGS="-j $NCORES"
make
make install

Note: At NCSA, there's a build of clang in ~mjuric/clang/3.0.