Setup iOS cross-compiling environment on Linux with cctools-port


  • In addition to our tutorial, you can also refer to the following two links.

  • Preparations

    • llvm clang 3.9.1: You can download and install llvm clang from the llvm website.
    • openssl 1.0.2g: Generally this tool is installed by default. Note that if you want to copy your created iOS cross compiler toolchain to another computer for use, you need to confirm that the versions of openssl on these two machines are the same, otherwise your created toolchain can not be used.
    • iPhoneOSSDK 10.0: If you don't have your own iPhoneOS SDK, you can download and choose one iPhoneOS SDK from iPhoneOSSDK, which contains iPhoneOS SDKs from the version 8.4 to 13.2.
    • cctools 949.0.1, ld64:530: This open-source tool can help us make the ARM-iOS cross compiler toolchain and you can clone the tool from cctools-port.
  • Step by Step

    1. Make sure that you have available tools including llvm clang and openssl.

    2. Clone iPhoneOS SDK from iPhoneOSSDK, and then place the archive in the user home directory ~/. For example we place it in /data/home/test. We tried to put it in other directories, but it failed for us.

    3. Clone cctools-port from cctools-port.

         test@ubuntu:~$ pwd
         /data/home/test
         test@ubuntu:~$ mkdir ioscompile
         test@ubuntu:~$ cd ioscompile
         test@ubuntu:~/ioscompile$ git clone https://github.com/tpoechtrager/cctools-port.git
         test@ubuntu:~/ioscompile$ ls  
         cctools-port-master
         test@ubuntu:~$ cd ..
      
    4. Use the shell script build.sh of cctools-port in the directory cctools-port-master/usage_examples/ios_toolchain/ to make aarch64/arm64-ios cross compiler toolchain. The commands are:

         test@ubuntu:~$ cd ioscompile/cctools-port-master/
         test@ubuntu:~$ ./usage_examples/ios_toolchain/build.sh  /data/home/test/iPhoneOS10.0.sdk.tar.gz arm64
      

      After a while, a folder target is created in the directory cctools-port-master/usage_examples/ios_toolchain/ and this folder target is the created aarch64-ios cross compiler toolchain. Now you have successfully made an ARM-IOS cross compiler toolchain on Linux. In this folder, the sub-folder /bin contains cross compilers and related tools like arm-apple-darwin-clang/clang++, and the sub-folder /lib contains the dependent libraries. By the way, if you want to make an armv7-ios cross compiler toolchain, you can change these commands like:

         test@ubuntu:~$ cd ioscompile/cctools-port-master/
         test@ubuntu:~$ ./usage_examples/ios_toolchain/build.sh  /data/home/test/iPhoneOS10.0.sdk.tar.gz armv7
      
    5. Configure the toolchain in your environment with the following commands or you can configure the toolchain permanently in your environment.

         test@ubuntu:~$ export PATH=/data/home/test/ioscompile/cctools-port-master/usage_examples/ios_toolchain/target/bin:$PATH
         test@ubuntu:~$ export LD_LIBRARY_PATH=/data/home/test/ioscompile/cctools-port-master/usage_examples/ios_toolchain/target/lib:$LD_LIBRARY_PATH
      

results matching ""

    No results matching ""