Build LLVM for macOS

Mar 13, 2019 • 预计阅读时间 1 分钟

Build LLVM

We build a toolchain for Xcode, and include these projects:

  • clang
  • clang-tools-extra
  • libcxx
  • libcxxabi
  • compiler-rt
  • libunwind
  • polly
  • lld

clone llvm project, and build the 7.0.1 version

git clone llvm-project
cd llvm-project/llvm
git checkout llvmorg-7.0.1
mkdir build && cd build &&

Build obfuscator-LLVM

obfuscator-LLVM upon LLVM, so We must clone LLVM project first.

We build heroims’ fork, because his fork is newer.

cd llvm-project
git clone obfuscator
cd obfuscator
git checkout llvm-7.0
mkdir build && cd build &&

set -e

# projects: clang; clang-tools-extra; libcxx; libcxxabi; libunwind; lldb; compiler-rt; lld; polly; debuginfo-tests


cmake -DCMAKE_INSTALL_PREFIX=${output} \
      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt;libunwind;polly;lld" \

make -j `sysctl -n hw.logicalcpu_max`
make install-xcode-toolchain

echo build finish.
echo toolchain installed at ${output}


You can use my build here:



iOS/macOS Developer

A simple Dispatch Queue Pool

Build boringssl for iOS