-
Notifications
You must be signed in to change notification settings - Fork 145
Building LLVM from Source
Scott L. Burson edited this page Jan 19, 2024
·
4 revisions
- Alternatively you might get llvm13 from your package manager, e.g.
brew
on macos git clone https://github.com/llvm/llvm-project.git
cd llvm-project
git checkout tags/llvmorg-16.0.0
mkdir -p build
cd build
- edit the
LLVM_BINUTILS_INCDIR
correctly, or you get afatal error: 'plugin-api.h' file not found
- for macosx it might be just
brew install binutils
. I didn't have ld.gold installed, so I did following https://llvm.org/docs/GoldPlugin.html - On macOS (be sure to include the \ at the end of each line):
cmake -G "Unix Makefiles" \
$xcode \
-DLLVM_CREATE_XCODE_TOOLCHAIN=ON \
-DLLVM_BINUTILS_INCDIR=/usr/local/opt/binutils/include \
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_LIBCXX=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_PROJECTS=clang\;lldb \
-DLLVM_ENABLE_RUNTIMES=libcxxabi\;libcxx \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/clasp \
../llvm
- For Linux, omit the second and third lines, which relate to Xcode.
cmake --build .
cmake --build . --target install