Compila llvm / clang en Linux

Requisitos

GCC> = 4.7 ( actualizaci贸n en ubuntu )

CMake> = 3.0

Obtener fuente

Suponemos que obtenemos y llvm acumulaci贸n en el directorio /local/llvm/, conjunto variable de entorno:
export LLVMDIR=/local/llvm/.

obtener llvm

cd /local
git clone http
://llvm.org/git/llvm.git

obtener sonido met谩lico

cd $LLVMDIR/tools
git clone http
://llvm.org/git/clang.git

conseguir herramientas clang (opcional)

cd $LLVMDIR/tools/clang/tools
git clone http
://llvm.org/git/clang-tools-extra.git extra

obtener comipler-rt

cd $LLVMDIR/projects
git clone http
://llvm.org/git/compiler-rt.git

obtener libcxx

cd $LLVMDIR/projects
git clone http
://llvm.org/git/libcxx.git

obtener libcxxabi

cd $LLVMDIR/projects
git clone http
://llvm.org/git/libcxxabi.git

Actualizaci贸n: util铆celo en git pull --rebaselugar de git pullpara evitar un historial no lineal.

edificio

compilar llvm / clang (gcc + automake)

cd $LLVMDIR
mkdir build

cd build

../configure --enable-optimized --disable-assertions # release build
make
-j8 # make use of 8 cores
make install
# /usr/local by default

construir libcxxabi (clang + cmake)

cd $LLVMDIR/projects/libcxxabi
mkdir build

cd build

CC
=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release ..
make
-j8
make install

make check
-libcxxabi # run tests

construir libcxx (clang + cmake)

cd $LLVMDIR/projects/libcxx
mkdir build

cd build

CC
=clang CXX=clang++ cmake -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_LIBCXXABI_INCLUDE_PATHS=$LLVMDIR/projects/libcxxabi/include -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_DIR=/usr .. # install libc++ and headers (c++/v1) to /usr
make
-j8
make install

Uso

clang++ -std=c++11 -stdlib=libc++ helloworld.cpp -lc++abi

Referencia

http://clang.llvm.org/get_started.html

http://compiler-rt.llvm.org/

http://libcxx.llvm.org/

http://libcxxabi.llvm.org/

http: // llvm .org / docs / CMake.html