Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Compiler to llvm-clang on existing iPhone Project

When I switch the Compiler Version to Clang llvm 1.0 in existing projects I get the following build error when Precompiling the *.pch file:

error: can't exec '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2' (No such file or directory)

Is there another setting I need to change to get my project to work with the new compiler?

(I did try a clean all targets)


Update:

To clarify:

Since the new compiler does in fact work with new projects, the issue is not that my system is missing anything.

Additionally, Xcode should not even be trying to find llvm-gcc-4.2 as the whole point is that I switched from that compiler to the new one, Clang llvm 1.0. This is what has led me to believe there is still another setting to be changed.


Thanks to fbereto for his suggestion. The actual answer lies in the comments.

like image 372
Corey Floyd Avatar asked Sep 11 '09 19:09

Corey Floyd


People also ask

Is LLVM and Clang the same?

There are 2 different things here. LLVM is a backend compiler meant to build compilers on top of it. It deals with optimizations and production of code adapted to the target architecture. CLang is a front end which parses C, C++ and Objective C code and translates it into a representation suitable for LLVM.

Does Apple use LLVM?

LLVM has been an integral part of Apple's Xcode development tools for macOS and iOS since Xcode 4. In 2006, Lattner started working on a new project called Clang. The combination of Clang front-end and LLVM back-end is called Clang/LLVM or simply Clang.

Does Xcode include LLVM?

Xcode also includes the LLVM GCC compiler, which uses the GCC compiler front end for maximum compatibility, and the LLVM back end, which takes advantage of LLVM's advanced code generator.


1 Answers

If you look in path specified by the error you will not find an LLVM compiler (llvm-gcc-4.2) for the iPhone device:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/

That being said one does exist for the iPhone Simulator:

/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/

All this to say that while it may be possible to compile your iPhone App under LLVM for the Simulator, no equivalent tool exists for the device itself.

(Answer detailed in comments below.)

like image 67
fbrereto Avatar answered Sep 29 '22 13:09

fbrereto