build LLVM 8 on macOS

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

TL;DR

download my pre-built:

LLVM8.0.1.xctoolchain.7z

MD5: 32241cb3e093b15c58bd40200dc2fd76

LLVM8.0.0.xctoolchain.7z

MD5: 169fd4d3fdffa5a136cbe77aac759cdc

prepare building lldb

  1. Install editline
  2. Install pcre && swig
  3. Read code-signing.txt

building

  1. clone llvm-project
  2. checkout 8.0 branch
  3. cd llvm
  4. run build-llvm.sh

build-llvm.sh

#!/bin/bash
set -e

mkdir build && cd build

output=/tmp/llvm-build

cmake -DCMAKE_INSTALL_PREFIX=${output} \
      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_INCLUDE_TESTS=OFF \
      -DLLVM_INCLUDE_EXAMPLES=OFF \
      -DLLDB_CODESIGN_IDENTITY='' \
      -DLLDB_BUILD_FRAMEWORK=ON \
      -DLLVM_ENABLE_PROJECTS="all" \
      -DLLVM_CREATE_XCODE_TOOLCHAIN=ON \
      -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
      -GNinja \
      ..

ninja
ninja install-xcode-toolchain

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

Note: you need install cmake and ninja first.

sign LLDB.framework

codesign --deep --force --verbose --sign "Developer ID Application: XXX (YYY)" LLDB.framework

if success, output:

signed bundle with Mach-O thin (x86_64) [com.apple.LLDB.framework]

版权声明:如果转发请带上本文链接和注明来源。

lvv.me

iOS/macOS Developer

Using xcrun

A simple Dispatch Queue Pool