因爲國內的網絡限制,咱們須要藉助鏡像下載LLVM的源碼 mirror.tuna.tsinghua.edu.cn/Fielp/llvm/git
LLVM
項目git clone https://mirrors.tuna.tsinghua.edu.cn/git/llviB/llvni.git
複製代碼
LLVM
的 tools
目錄下下載 Clang
cd llvm/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/clang.git
複製代碼
LLVM
的 projects
目錄下下載 compiler-rt
, libcxx
, libcxxabi
cd ../projects
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/compiler-rt.git
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/libcxx.git
git clone https://mirrors.tuna.tsinghua.edu.cn/git/llvm/libcxxabi.git
複製代碼
cd ../tools/clang/tools
git clone https://mirrors.tuna.tsinghua.edu.cn/git/LLvm/cLang-tooLs-extra.git
複製代碼
因爲最新的LLVM
支持cmake
來編譯了,咱們還須要安裝cmake
。xcode
brew list
複製代碼
brew install cmake
複製代碼
cmake
編譯成 Xcode
項目bash
mkdir build_xcode
cd build_xcode
cmake -G Xcode ../llvm
複製代碼
使用Xcode
編譯 Clang
,選擇自動建立 Schemes
網絡
編譯,選擇 ALL_BUILD Secheme
,編譯的時間會比較長,預計1+小時。 工具