Problem of building llvm/clang using CMake


I am trying to build llvm/clang on my macbook. But it always failed for me.

First, I git clone the code to /usr/local/llvm-src/ folder:

$ git clone
$ cd llvm/tools
$ git clone
$ cd …/projects
$ git clone
$ cd …/tools/clang/tools
$ git clone

Then, I generate the Xcode from the /usr/local/llvm-src/build folder and specify the target install directory of /usr/local/llvm-src/install:
cmake -G Xcode -DCMAKE_INSTALL_PREFIX=/usr/local/llvm-src/install /usr/local/llvm-src/llvm

Finally, I open the generated project file in Xcode, switch the schema to “Install” and run “Build” from Product menu. But it failed in Xcode with error below:

CMake Error at projects/compiler-rt/lib/builtins/cmake_install.cmake:31 (file):

file INSTALL cannot find


Call Stack (most recent call first):

projects/compiler-rt/lib/cmake_install.cmake:32 (include)

projects/compiler-rt/cmake_install.cmake:33 (include)

projects/cmake_install.cmake:32 (include)

cmake_install.cmake:55 (include)

make: *** [install_buildpart_0] Error 1

Command /bin/sh failed with exit code 2

Any ideas?