Cross-compiling for iOS on Linux

    While it is possible to compile for iOS on a Linux environment, Apple is very restrictive about the tools to be used (especially hardware-wise), allowing pretty much only their products to be used for development. So this is not official. However, a says they relaxed some of the App Store review guidelines to allow any tool to be used, as long as the resulting binary does not download any code, which means it should be OK to use the procedure described here and cross-compiling the binary.

    • (a dmg image)
    • Clang >= 3.5 for your development machine installed and in the . It has to be version >= 3.5 to target arm64 architecture.
    • , which needs to be built from source. The procedure for that is explained below.
      • For building darling-dmg, you’ll need the development packages of the following libraries: fuse, icu, openssl, zlib, bzip2.
    • cctools-port for the needed build tools. The procedure for building is quite peculiar and is described below.
      • This also has some extra dependencies: automake, autogen, libtool.

    Clone the repository on your machine:

    Build it:

    1. $ cd darling-dmg
    2. $ mkdir build
    3. $ cd build
    4. $ cmake .. -DCMAKE_BUILD_TYPE=Release
    5. $ make -j 4 # The number is the amount of cores your processor has, for faster build
    6. $ cd ../..

    Mount the XCode image:

    1. [...]
    2. Everything looks OK, disk mounted

    Pack the SDK:

    1. $ cd iPhoneSDK
    2. $ tar -cf - * | xz -9 -c - > iPhoneOS9.1.sdk.tar.xz

    Build cctools:

    1. $ git clone https://github.com/tpoechtrager/cctools-port.git
    2. $ cd cctools-port/usage_examples/ios_toolchain
    3. $ ./build.sh /path/iPhoneOS9.1.sdk.tar.xz arm64

    Copy the tools to a nicer place. Note that the SCons scripts for building will look under usr/bin inside the directory you provide for the toolchain binaries, so you must copy to such subdirectory, akin to the following commands:

    Now you should have the iOS toolchain binaries in .

    For the iPhone platform to be detected, you need the OSXCROSS_IOS environment variable defined to anything.

    1. $ export OSXCROSS_IOS=anything

    Now you can compile for iPhone using SCons like the standard Godot way, with some additional arguments to provide the correct paths:

    1. $ scons -j 4 platform=iphone arch=arm target=release_debug IPHONESDK="/path/to/iPhoneSDK" IPHONEPATH="/path/to/iostoolchain" ios_triple="arm-apple-darwin11-"

    Apple requires a fat binary with both architectures (armv7 and arm64) in a single file. To do this, use the arm-apple-darwin11-lipo executable. The following example assumes you are in the root Godot source directory:

    Then you will have an iOS fat binary in bin/godot.iphone.opt.debug.fat.