<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
1) I added the following line to CMakeLists.txt under llvm-project/clang:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    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")</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
2) I set CMAKE_OSX_SYSROOT to: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Then recompiling the code gives me errors like below:</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><i>[ 21%] Building AttributesCompatFunc.inc...<br>
</i></span>
<div><i>dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)<br>
</i></div>
<div><i>dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)<br>
</i></div>
<div><i>dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)<br>
</i></div>
<div><i>/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<br>
</i></div>
<div><i>/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<br>
</i></div>
<div><i>/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<br>
</i></div>
<div><i>make[3]: *** [lib/IR/AttributesCompatFunc.inc] Error 134<br>
</i></div>
<div><i>make[3]: *** [tools/clang/include/clang/Driver/Options.inc] Error 134<br>
</i></div>
<div><i>make[3]: *** [lib/Transforms/InstCombine/InstCombineTables.inc] Error 134<br>
</i></div>
<div><i>make[2]: *** [lib/IR/CMakeFiles/AttributeCompatFuncTableGen.dir/all] Error 2<br>
</i></div>
<i><span></span></i></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span><i>[ 21%] Building IntrinsicsAMDGPU.h...<br>
</i></span>
<div><i>dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)<br>
</i></div>
<div><i>/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<br>
</i></div>
<div><i>make[3]: *** [include/llvm/IR/IntrinsicImpl.inc] Error 134<br>
</i></div>
<div><i>make[3]: *** Waiting for unfinished jobs....<br>
</i></div>
<div><br>
</div>
<div>Could someone explain what those errors mean and how to resolve them?</div>
<div>I did set <span style="caret-color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif;">DYLD_ROOT_PATH to the location of the Simulator executable but that didn't help.</span></div>
<div><span style="background: var(--white);">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.</span><br>
</div>
<div>Any help is greatly appreciated.</div>
<div><br>
</div>
<div>--</div>
<div>Thanks,</div>
<div>Igor</div>
<span></span><br>
</div>
</body>
</html>