Building LLVM and Clang with Xcode 5

Hi All,

I’m new to hacking on clang and I’m trying to build with Xcode.

I got the code from the git mirror, first checking out llvm, and then clang into llvm/tools/clang, compiler-rt code to llvm/project/compiler-rt and the test suite to llvm/projects/test-suite (I basically followed the instructions here: http://llvm.org/docs/GettingStarted.html#git-mirror)

I then used cmake to generate the LLVM xcode project.

When I build the ALL_BUILD target I very quickly get the following error compiling asan_activation.c:

lang: error: invalid argument ‘-mmacosx-version-min=10.9’ not allowed with ‘-mios-simulator-version-min=7.0’

Any thoughts on what is going wrong? I am a little surprised because I haven’t even tried to change anything yet.

Thanks,

Guy.

Hi ,

knowing the exact commands would be good, but this usually works well for me:

mkdir llvm_build_xcode
cd llvm_build_xcode
cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug /Path/To/llvm
open Xcode project and compile.

Let me know if it works for you

Marcello

Hi ,

knowing the exact commands would be good, but this usually works well for me:

mkdir llvm_build_xcode
cd llvm_build_xcode
cmake -G Xcode -DCMAKE_BUILD_TYPE=Debug /Path/To/llvm
open Xcode project and compile.

Let me know if it works for you

Marcello

Seems like my mail client had some problems and sent too many messages, sorry about that :stuck_out_tongue:

Marcello

If you just want to hack on clang, remove the compiler-rt and test-suite checkouts. Clang has tests in its source checkout that are small, targeted, and run in ~1min.

The specific error you got has something to do with cross-compiling the sanitizers for iOS from Mac OS, which I’m guessing you may not care about. Here’s an old thread about it:
http://clang-developers.42468.n3.nabble.com/CMake-Xcode-build-fails-trying-to-build-asan-td4037916.html

Hi Marcello,

That didn’t seem to solve my problem… My commands were almost the same as yours the first time anyway… I just left out -DCMAKE_BUILD_TYPE=Debug.

Anyhow, there was another email which suggested that I can probably leave out the compiler-rt stuff. I’m going to give that at try.

Thanks,

Guy.

Hi Reid,

I will try removing the compiler-rt and test suite checkouts and see how it goes.

Thanks,

Guy.

Ouch, you are right, I also use other CMake options actually , which are :

Turning off LLVM_EXTERNAL_COMPILER_RT_BUILD and LLVM_BUILD_EXTERNAL_COMPILER_RT with Xcode because I don’t need those.

Marcello