<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Thank you Jacob for your answer. It is quite helpful. </div><div class="">Sorry for not responding sooner - I wasn't getting messages from llvm-dev for awhile for some reason and had to re-subscribe from a different e-mail address.</div><div class=""><br class=""></div><div class="">So I followed the link at the bottom<span class="Apple-tab-span" style="white-space:pre"> </span>of your response and I am now using the following command to cross-compile for iOS:</div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">cmake -S . -B build_iOS_make -G "Unix Makefiles"  -DCMAKE_SYSTEM_NAME=iOS "-DCMAKE_OSX_ARCHITECTURES=x86_64" -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=`pwd`/_install -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO -DCMAKE_IOS_INSTALL_COMBINED=YES -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.4.sdk"</span></div></div><div class=""><br class=""></div><div class="">And with that I was able to compile some 61% of LLVM. </div><div class="">Now I am stuck here:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">[ 61%] Built target yaml-bench</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">[ 61%] Built target LTO_exports</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; color: rgb(57, 192, 38);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">[ 61%] </span><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">Linking CXX shared library ../../lib/libLTO.dylib</b></span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">ld: unknown option: -z</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">clang: </span><span style="font-variant-ligatures: no-common-ligatures; color: #ca3323" class=""><b class="">error: </b></span><span style="font-variant-ligatures: no-common-ligatures" class="">linker command failed with exit code 1 (use -v to see invocation)</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">make[2]: *** [lib/libLTO.dylib] Error 1</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">make[1]: *** [tools/lto/CMakeFiles/LTO.dir/all] Error 2</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">make: *** [all] Error 2</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">I am now going through the CMake scripts trying to figure out where that option is set and how to remove it.</div><div class="">Honestly, I am not even sure what that options means. I tried ignoring libLTO target but it had snowballing effect as that target is referenced in a number of other places it seems.</div><div class=""><br class=""></div><div class="">As for your remark about not being able to invoke the “fork” system call: my hope was to interpret C++ code on the target platform - the way lli tool does or JIT-compiling it when possible.</div><div class="">I am not sure about that, though - so wanted to give that a try to see how that goes.</div><div class=""><br class=""></div><div class="">—</div><div class="">Best Regards,</div><div class="">Igor Gomon</div><div class=""><br class=""></div><div class=""><b style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class="">Jacob Carlborg via llvm-dev</b><span style="font-family: -webkit-standard; font-size: medium; background-color: rgb(255, 255, 255);" class=""> </span><a href="mailto:llvm-dev%40lists.llvm.org?Subject=Re%3A%20%5Bllvm-dev%5D%20Trying%20to%20compile%20LLVM/Clang%20for%20iOS%20iPhoneSimulator%0A%09gives%20errors&In-Reply-To=%3Cr5vbiv%24c7s%241%40ciao.gmane.io%3E" title="[llvm-dev] Trying to compile LLVM/Clang for iOS iPhoneSimulator gives errors" style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class="">llvm-dev at lists.llvm.org </a></div><i style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class="">Tue Mar 31 05:03:43 PDT 2020</i><span style="font-family: -webkit-standard; font-size: medium; background-color: rgb(255, 255, 255);" class=""></span><div style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class=""><br class="webkit-block-placeholder"></div><ul style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class=""><li class="">Previous message: <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/140488.html" class="">[llvm-dev] Trying to compile LLVM/Clang for iOS iPhoneSimulator gives errors</a></li><li class="">Next message: <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/140496.html" class="">[llvm-dev] llvm-lit and cmake and out-of-tree builds.</a></li><li class=""><b class="">Messages sorted by:</b> <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/date.html#140513" class="">[ date ]</a> <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/thread.html#140513" class="">[ thread ]</a> <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/subject.html#140513" class="">[ subject ]</a> <a href="http://lists.llvm.org/pipermail/llvm-dev/2020-March/author.html#140513" class="">[ author ]</a></li></ul><hr style="font-family: -webkit-standard; background-color: rgb(255, 255, 255);" class=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">On 2020-03-30 23:37, Igor Gomon via llvm-dev wrote:

><i class=""> I am trying to compile LLVM/Clang(10.0) for iOS Simulator (SDK 13.4)
</i>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: 
<a href="https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos" class="">https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos</a>

-- 
/Jacob Carlborg</pre><div class=""><br class=""></div></body></html>