Cross-Compiling für iOS unter Linux

The procedure for this is somewhat complex and requires a lot of steps, but once you have the environment properly configured it will be easy to compile Godot for iOS anytime you want.


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 statement from Apple in 2010 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.


  • XCode mit dem iOS SDK (ein dmg-Bild)

  • Clang >= 3.5 for your development machine installed and in the PATH. It has to be version >= 3.5 to target arm64 architecture.

  • Sicherung zum Einbinden und Freigeben des dmg-Images.

  • darling-dmg, 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.

    • Dies hat auch einige zusätzliche Abhängigkeiten: automake, autogen, libtool.

Umgebung konfigurieren


Klonen Sie das Repository auf Ihrem Computer:

$ git clone

Baue es:

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

SDK vorbereiten

Einbinden des XCode image:

$ mkdir xcode
$ ./darling-dmg/build/darling-dmg /path/to/Xcode_7.1.1.dmg xcode
Everything looks OK, disk mounted

Extrahieren des iOS SDK:

$ mkdir -p iPhoneSDK/iPhoneOS9.1.sdk
$ cp -r xcode/* iPhoneSDK/iPhoneOS9.1.sdk
$ cp -r xcode/* iPhoneSDK/iPhoneOS9.1.sdk/usr/include/c++
$ fusermount -u xcode  # unmount the image

SDK packen:

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


cctools bauen:

$ git clone
$ cd cctools-port/usage_examples/ios_toolchain
$ ./ /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:

$ mkdir -p /home/user/iostoolchain/usr
$ cp -r target/bin /home/user/iostoolchain/usr/

Jetzt sollten Sie die iOS-Toolchain-Binärdateien in /home/user/iostoolchain/usr/bin haben.

Godot für iPhone kompilieren

Sobald Sie die oben genannten Schritte ausgeführt haben, sollten Sie zwei Dinge in Ihrer Umgebung behalten: die erstellte Toolchain und das iPhoneOS SDK-Verzeichnis. Diese können überall bleiben, da Sie ihre Pfade zum SCons-Build-Befehl angeben müssen.

Damit die iPhone-Plattform erkannt werden kann, muss die Umgebungsvariable OSXCROSS_IOS für alles definiert sein.

$ export OSXCROSS_IOS=anything

Jetzt können Sie mit SCons für das iPhone nach dem Standard-Godot-Weg kompilieren, mit einigen zusätzlichen Argumenten, um die richtigen Pfade anzugeben:

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

Fette Binärdateien produzieren

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:

$ /path/to/iostoolchain/usr/bin/arm-apple-darwin11-lipo -create bin/libgodot.iphone.opt.debug.arm.a bin/libgodot.iphone.opt.debug.arm64.a -output bin/libgodot.iphone.debug.fat.a
$ /path/to/iostoolchain/usr/bin/arm-apple-darwin11-lipo -create bin/libgodot_camera_module.iphone.opt.debug.arm.a bin/libgodot_camera_module.iphone.opt.debug.arm64.a -output bin/libgodot_camera_module.iphone.debug.fat.a
$ /path/to/iostoolchain/usr/bin/arm-apple-darwin11-lipo -create bin/libgodot_arkit_module.iphone.opt.debug.arm.a bin/libgodot_arkit_module.iphone.opt.debug.arm64.a -output bin/libgodot_arkit_module.iphone.debug.fat.a

Dann werden Sie iOS Fat-Binärdateien im Verzeichnis bin haben.