Hello,
I am trying to compile LLVM/Clang(10.0) for iOS Simulator (SDK 13.4) and to do that I have made the following changes to the codebase:
- I added the following line to CMakeLists.txt under llvm-project/clang:
set (CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -miphoneos-version-min=13.4”) - I set CMAKE_OSX_SYSROOT to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk.
Then recompiling the code gives me errors like below:
[ 21%] Building AttributesCompatFunc.inc…
dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)
dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)
dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)
/bin/sh: line 1: 24864 Abort trap: 6 …/…/bin/llvm-tblgen -gen-attrs -I /Users/igorgomon/dev/third-party/llvm-project/llvm/lib/IR -I /Users/igorgomon/dev/third-party/llvm-project/llvm/include /Users/igorgomon/dev/third-party/llvm-project/llvm/lib/IR/AttributesCompatFunc.td --write-if-changed -o /Users/igorgomon/dev/third-party/llvm-project/llvm/cmake-build-debug/lib/IR/AttributesCompatFunc.inc
/bin/sh: line 1: 24863 Abort trap: 6 …/…/…/…/…/bin/llvm-tblgen -gen-opt-parser-defs -I /Users/igorgomon/dev/third-party/llvm-project/clang/include/clang/Driver -I /Users/igorgomon/dev/third-party/llvm-project/llvm/include /Users/igorgomon/dev/third-party/llvm-project/clang/include/clang/Driver/Options.td --write-if-changed -o /Users/igorgomon/dev/third-party/llvm-project/llvm/cmake-build-debug/tools/clang/include/clang/Driver/Options.inc
/bin/sh: line 1: 24862 Abort trap: 6 …/…/…/bin/llvm-tblgen -gen-searchable-tables -I /Users/igorgomon/dev/third-party/llvm-project/llvm/lib/Transforms/InstCombine -I /Users/igorgomon/dev/third-party/llvm-project/llvm/include /Users/igorgomon/dev/third-party/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineTables.td --write-if-changed -o /Users/igorgomon/dev/third-party/llvm-project/llvm/cmake-build-debug/lib/Transforms/InstCombine/InstCombineTables.inc
make[3]: *** [lib/IR/AttributesCompatFunc.inc] Error 134
make[3]: *** [tools/clang/include/clang/Driver/Options.inc] Error 134
make[3]: *** [lib/Transforms/InstCombine/InstCombineTables.inc] Error 134
make[2]: *** [lib/IR/CMakeFiles/AttributeCompatFuncTableGen.dir/all] Error 2
[ 21%] Building IntrinsicsAMDGPU.h…
dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)
/bin/sh: line 1: 24873 Abort trap: 6 …/…/…/bin/llvm-tblgen -gen-intrinsic-impl -I /Users/igorgomon/dev/third-party/llvm-project/llvm/include/llvm/IR -I /Users/igorgomon/dev/third-party/llvm-project/llvm/include /Users/igorgomon/dev/third-party/llvm-project/llvm/include/llvm/IR/Intrinsics.td --write-if-changed -o /Users/igorgomon/dev/third-party/llvm-project/llvm/cmake-build-debug/include/llvm/IR/IntrinsicImpl.inc
make[3]: *** [include/llvm/IR/IntrinsicImpl.inc] Error 134
make[3]: *** Waiting for unfinished jobs…
Could someone explain what those errors mean and how to resolve them?
I did set DYLD_ROOT_PATH to the location of the Simulator executable but that didn’t help.
Also if there is any guide on how to compile LLVM/Clang for iOS simulator I would greatly appreciate if anyone shared it with me.
Any help is greatly appreciated.