Compile for iOS on Linux - scons: too many errors emitted, stopping now

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Yugo
:warning: Old Version Published before Godot 3 was released.

I followed this tutorial: Cross-compiling for iOS on Linux — Godot Engine (latest) documentation in English

I finished the topic “Configuring the environment” and now I have problems at “Compiling Godot for iPhone”.

When I run this command: scons -j 4 platform=iphone bits=32 target=release_debug IPHONESDK=“/home/yugo/Development/Other/iPhoneSDK/iPhoneOS9.1.sdk” IPHONEPATH=“/home/yugo/Development/Other/iostoolchain” ios_triple=“arm-apple-darwin11-”

I get errors like:
error: expected ‘;’ after @class [4] @class NSArray;
error: cannot find protocol declaration for ‘ObjectType’ [2] @class NSArray;

and much more…
Here is the full output: scons -j 4 platform=iphone bits=32 target=release_debug IPHONESDK="/home/yugo/De - Pastebin.com

For xCode I used: Xcode_7.3_beta_3.dmg
And if the problem has to do with clang… I really didn’t know how to install it so I have clang 3.5, 3.6, 3.7 and something else…
Maybe you could tell me how to correctly install it on Ubuntu 15.04 if it has a connection with the problems.

How can I solve the problems and get it working?

:bust_in_silhouette: Reply From: Freeman

I would try with older Xcode around 6.4 that provides older SDK’s (Sign In - Apple if you have dev account there) or maybe newer one Xcode 7.3 beta 4 from https://developer.apple.com/xcode/download/

Also are you sure your Clang >= 3.5 is in path?

Cross-compiling seams to be harder then expected. :frowning:

Is your Ubuntu 64-bit?

I have Ubuntu 15.04 64 Bit. Right now I’m downloading xCode 6.4 and will try it.
I’m not sure if it is in the path :confused: I didn’t add anything. How do I add it to the path? I installed clang with sudo apt-get install clang-3.7.

Yugo | 2016-02-22 23:44

try
clang --help
in the console. If it’s in the path it will show help.

To put it in the path you need command like
export PATH=/usr/clang_3_5/bin:$PATH but of course with your version and the actual place it’s installed into.
To make it permanent you need to put that line at the end of the hidden /.profile file that you find in your home/user directory, if I remember correctly how ubuntu sets it.

Freeman | 2016-02-22 23:57

It worked thank you so much Freeman!! :))
Now I’m finally creating the fat binary. But I need to be in the root directory of the godot source for creating the fat. Thats strange… Where am I creating the binary for my game project? I thought I have to tell him somehow which of my game projects he needs to make a .ipa from? Or is this an export template?

Yugo | 2016-02-23 00:15

I am glad to help. Dont worry, this is just an export template. You will export your game from Godot’s UI - export menu. There you should have now (after putting export templates into ./godot/templates folder) option to export to iOS or Mac I guess. Congratulation. :slight_smile:

Freeman | 2016-02-23 00:45

I copied the 3 files: godot.iphone.opt.debug.32, godot.iphone.opt.debug.64, godot.iphone.opt.debug.fat to ~/.godot/templates, restarted godot but I only see this: http://www2.pic-upload.de/img/29824496/godot.png :frowning: :frowning: No iOS :frowning:

Yugo | 2016-02-23 01:07

I am asking around if that is a valid look of iOS exports in Godot. We will see.
What is the output when you press the export button? Does the exported binary work on OSX for example?

Freeman | 2016-02-23 11:30

Thank you so much Freeman, that you will help me and ask! :slight_smile:
It exports without errors to an .app, but I don’t have OSX to test it.

Yugo | 2016-02-23 12:12

:bust_in_silhouette: Reply From: Yugo

Freeman gave me the hint to check if clang is in the $PATH. And this did the trick.

I installed clang with: sudo apt-get install clang-3.7
Then I added the according folder /usr/lib/llvm-3.7/bin to the Path.

I just added this line to end of ~/.bashrc:
export PATH=/usr/lib/llvm-3.7/bin:$PATH

nano ~/.bashrc
Add the line
source ~/.bashrc

Now it finally worked :slight_smile:

:bust_in_silhouette: Reply From: Freeman

So export templates exports app that should run on OSX. But we also want ipa for iOS.
The process of making ipa from what is exported from Godot is described here:
http://docs.godotengine.org/en/latest/tutorials/asset_pipeline/exporting_for_ios.html

The bad news is that it needs to be done OSX and it can’t be done in linux unless in virtualbox or similar emulator that would be able to run whole OSX.

Okay, but what for was then this whole process?
I mean the tutorial I followed “Cross-compiling for iOS on Linux”?
The link you posted doesn’t need anything I did.
What is then the usage of the fat? And what is the use-case?

Yugo | 2016-02-23 13:13

The first tutorial you did was for cross-compiling OSX on linux to have an OSX templates that are needed to go further and prepare ipa in Xcode.
You could use templates that are prepared in Godot now, if you stay with the actual stable version that is ready to download, like today released 2.0 stable, but we were talking yesterday where there was no 2.0 yet and I was given this link today on irc channel.
And frankly it’s good to know how to compile your own templates, in case you want to clone/pull the source code from github and compile the newest godot version by yourself and not wait months for the next official release.

Freeman | 2016-02-23 13:19

But the title says Cross-Compiling iOS and not OSX.
And if you look at the Disclaimer:
“While it is possible to compile for iOS on a Linux environment, Apple is very restrictive about the tools to be used (specially 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.”

This sounds like we are doing something maybe “illegal”, so the only thing I can think of is we are able to create the .ipa later with the fat we created on Linux?

Yugo | 2016-02-23 13:27

Something illegal… well, then you should wait for the knocking on your door at 6:00am I guess :wink:
That’s true, that Apple at first wanted people to develop only using Apple tools and Apple machines, but they changed that some time ago and are not that strict anymore about it.
Yes after creating the fat OSX binary on Linux - that alone is super cool as has been not possible for a long time. We are able to create ipa from it, maybe even without Apple computer and on linux with virtual environments like virtualbox.
But the general rule is, that the best platform for running Godot is probably OSX, because you are able to create binaries for most operating systems from it. With easy running Xcode iOS ipa’s included.

Freeman | 2016-02-23 14:14