[llvm-dev] Trying to compile LLVM/Clang for iOS iPhoneSimulator gives errors

Jacob Carlborg via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 31 05:03:43 PDT 2020


On 2020-03-30 23:37, Igor Gomon via llvm-dev wrote:

> I am trying to compile LLVM/Clang(10.0) for iOS Simulator (SDK 13.4)
The way code is compiled for iOS (simulator or native device) is to 
cross-compile it.

As far as I know, it's not possible to run a compiler on the simulator 
or device. You're not allowed to invoke the "fork" system call, that 
means you cannot create a new process. That means, if you do have a 
compiler for iOS, there's no way to run it.

BTW, the proper way to cross-compile for iOS using cmake is to set the 
following cmake variables:

CMAKE_SYSTEM_NAME=iOS
CMAKE_OSX_ARCHITECTURES=arm64 # architecture
CMAKE_OSX_DEPLOYMENT_TARGET=12.0 # minimum deployment target

The above are examples for targeting the native device. Not sure of the 
exact values for the simulator.

For more information, see: 
https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos

-- 
/Jacob Carlborg



More information about the llvm-dev mailing list