Requisitos
GCC> = 4.7 ( atualização no ubuntu )
CMake> = 3.0
Obter fonte
Suponha que temos e llvm construção no diretório /local/llvm/
, conjunto variável de ambiente: export LLVMDIR=/local/llvm/
.
obter llvm
cd /local
git clone http://llvm.org/git/llvm.git
obter clang
cd $LLVMDIR/tools
git clone http://llvm.org/git/clang.git
obter ferramentas do clang (opcional)
cd $LLVMDIR/tools/clang/tools
git clone http://llvm.org/git/clang-tools-extra.git extra
obter comipler-rt
cd $LLVMDIR/projects
git clone http://llvm.org/git/compiler-rt.git
obter libcxx
cd $LLVMDIR/projects
git clone http://llvm.org/git/libcxx.git
obter libcxxabi
cd $LLVMDIR/projects
git clone http://llvm.org/git/libcxxabi.git
Atualizar: use em git pull --rebase
vez de git pull
para evitar histórico não linear.
Construção
build 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