-
Notifications
You must be signed in to change notification settings - Fork 2
toolchain_build_instructions
This document describes how to build a llvm/clang based toolchain from lll-project GIT repositories. Currently, we support only X86_32 and X86_64 architectures.
PRJ_DIR="$HOME/src/lll-project"
mkdir -p $PRJ_DIR
cd $PRJ_DIR
git clone https://github.com/lll-project/llvm
cd llvm/tools
git clone https://github.com/lll-project/clang
WARNING: In the future we plan to support libc++ from clang project (current status: experimental)
cd clang/runtime
git clone https://github.com/lll-project/libcxx
export LANG=C
export LC_ALL=C
MAKE="make"
CC_FOR_BUILD="gcc"
CXX_FOR_BUILD="g++"
Here, a "classic" /opt installation is intended:
BUILD_DIR="$PRJ_DIR/llvm-build"
PREFIX="/opt/llvm"
HINT: If /opt directory is not an option for you (or not accessible), use PREFIX=$HOME/install instead.
CONFIGURE_OPTS="--enable-optimized --enable-assertions --enable-targets=host-only"
cd $BUILD_DIR
../llvm/configure --prefix=$PREFIX $CONFIGURE_OPTS
CMAKE_OPTS="-DCMAKE_BUILD_TYPE=RELEASE -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86"
cd $BUILD_DIR
cmake ../llvm -DCMAKE_INSTALL_PREFIX=$PREFIX $CMAKE_OPTS
NOTE: There is no 1:1 replacement for "--enable-targets=host-only" configure-option. "X86" as target is used for both X86_32 and X86_64.
HINT: How to get a list of all available cmake variables?
cd $BUILD_DIR
cmake ../llvm -LA
MAKE_JOBS="2"
$MAKE CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD -j$MAKE_JOBS 2>&1 | tee ../build_toolchain.log
cd $BUILD_DIR
root# $MAKE install 2>&1 | tee ../install_toolchain.log
For Debian systems create a new llvm-with-clang.conf file:
[ /etc/ld.so.conf.d/llvm-with-clang.conf ]
# LLVM and clang lib configuration
/opt/llvm/lib
Update dynamic linker run-time bindings:
root# ldconfig
Finally, export the PATH variable by adding the toolchain-bin directory:
PREFIX="/opt/llvm"
export PATH=$PATH:$PREFIX/bin