Non-Apple-Mac IOS/iPhone toolchain – various information

Forgive this mother-of-all brain-dumps :expressionless: .

“Never say never, because limits, like fears, are often just an illusion.”

― Michael Jordan

Technology is about making the impossible, possible, right? We can build IOS binaries on non-mac hardware, we just need to bring the necessary tools together.

Until recently, I was led to believe Java couldn’t be used to code for IOS, but hey, Avian/IKVM-Monotouch/RoboVM-LLVM say differently. As for building IOS executables while not using a Mac, well various development tools are doing this already, one example is the commercial Marmalade SDK (http://www.madewithmarmalade.com - I have no association).

Below is a rag-tag set of information I’ve compiled, hopefully with the idea of offering a real solution for freely and legally compiling 100% IOS-compatible applications on non-Apple hardware without the need for Mac virtualisation etc. You’ll still need an Apple developer account of some kind (free for dev tools downloads) and none of this will get around the $99 Apple fee for App Store distribution (no answer for that).

So, some ‘connect the dots’ is probably necessary, but that’s what open-source is often about, I’m just lighting the touch paper.

Cheers

Rich

  • Getting a non-mac IOS compiler tool chain

Quoting a StackOverFlow answer (http://stackoverflow.com/a/2406839/304330):

"The low-level toolchain for Xcode (the gcc compiler family, the gdb debugger, etc.) is all open source and common to Unix and Linux platforms..."

OK, the principle part of our ‘sauce’ would be:

https://github.com/H2CO3/xchain-ios (see https://github.com/polyvertex/xchain-ios fork for a Windows/Cygwin compatible patch).

xchain-ios is an IOS-capable GCC+tools implementation and is the designed around the research within the following document:

http://devs.openttd.org/%7Etruebrain/compile-farm/apple-darwin9.txt

According to the developer, H2CO3, xchain-ios has been tested on iOS 4.2.1 on iPhone 3G and iOS 5.1.1 on iPad 3.

The following Bash script describes using 7zip to decompress and install XCode’s DMGs on non-Mac hardware (this may require HFS kernel modules):

https://github.com/shinh/maloader/blob/master/unpack_xcode.sh

The structure of an IPA:

/Payload/
/Payload/Application.app
/iTunesArtwork
/iTunesMetadata.plist

**** Apple’s codesign CPP source - as used by Marmalade on Windows etc.
http://opensource.apple.com/source/security_systemkeychain/security_systemkeychain-55002/src/codesign.cpp


#Apple FOSS code mirror (includes codesign.h/cpp etc.)

https://github.com/Apple-FOSS-Mirror/security_systemkeychain/tree/master/src

The following Bash script outlines signing an IPA (*.ipa) IOS zip bundle with a ‘codesign’ utility

#!/bin/sh
#======ipaCodesign.sh=============

Found at http://stackoverflow.com/a/10515547/304330

#Given that the application name is MyApplication.ipa
export ARCHIVE_NAME=“MyApplication”
#As indicated in the keychain certifcate common name
export CERTFICATE_NAME=“MyCertificate”
rm -rf ./Payload
echo “$ARCHIVE_NAME”".ipa" “$ARCHIVE_NAME”".backup"
unzip “$ARCHIVE_NAME”".ipa"
codesign -f -s “$CERTFICATE_NAME” ./Payload/“The package name in the Payload folder with the extension”
zip -r ./"$ARCHIVE_NAME"".zip" ./Payload
cp “$ARCHIVE_NAME”".ipa" “$ARCHIVE_NAME”".backup"
mv “$ARCHIVE_NAME”".zip" “$ARCHIVE_NAME”".ipa"
rm -rf ./Payload
echo “Finished Code Sign successfully”

#======End ipaCodesign.sh=============

*PLIST handling - see http://stackoverflow.com/a/1749248/304330
https://github.com/playhaven/sdk-ios/blob/master/example/Info-udid.plist ← Example IOS XML plist
http://scw.us/iPhone/plutil XML plist converter, Windows/Linux
http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/plutil.1.html
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html
http://www.quantum-step.com/download/sources/mystep/Tools/PlistBuddy.m ← tool for plist key addition
http://hg.openpanel.com/grace/file/05c5081a23e0/schemas/com.apple.plist.schema.xml
http://code.google.com/p/plist ← IOS-compatible Java-based PList (XML) modification library
http://sourceforge.net/p/plist
http://code.google.com/p/xmlwise

#Misc. related links

http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/ditto.1.html ← IPA-capable app-bundler

http://cakoose.com/wiki/plist_xml_is_pointless

https://gist.github.com/sharpland/1365444 ← ReCodeSign
http://floatlearning.com/2011/11/re-signing-an-ios-app-without-xcode
http://www.ketzler.de/2011/01/resign-an-iphone-app-insert-new-bundle-id-and-send-to-xcode-organizer-for-upload
http://support.brightcove.com/en/app-cloud/docs/step-step-guide-publishing-apple-app-store-using-windows

http://darling.dolezel.info/en/Darling
https://github.com/LubosD/darling ← Darwin on Linux (like Wine)

http://speirs.org/blog/2007/12/5/what-are-xib-files.html
http://kosmaczewski.net/projects/nib2objc

http://www.puredarwin.org/developers/cf-lite

3 Likes

Its all relatively clear and easy as soon as you have jailbroken your phone. However I don’t see the point in trying to circumvent exactly the company that puts you in the position to offer your application to millions of users… Additionally, when iOS deployment is working you won’t have much platform specific code anyway and any advancements / additions made without the apple toolchain would not qualify as valid jME extensions. In other words… “Theres android for that” :wink:

Touché Normen,
You’re right of course, basically, I find the idea of cross-compiling from non-Mac OSes intriguing and I guess it is simply one of those ‘because you can’ moments.

I’d still like to keep this information in the public domain, so, as soon as I can set up my own blog, I’ll remove this content from here so as to not trouble the JMonkey community.

Apologies

2 Likes
@sixman9 said: Touché Normen, You're right of course, basically, I find the idea of cross-compiling from non-Mac OSes intriguing and I guess it is simply one of those 'because you can' moments.

I’d still like to keep this information in the public domain, so, as soon as I can set up my own blog, I’ll remove this content from here so as to not trouble the JMonkey community.

Apologies

Oh, no reason for apologies. I should have started the post with “thank you”, sorry :slight_smile: No need to remove this content.

<cite>@normen said:</cite> I don't see the point in trying to circumvent exactly the company that puts you in the position to offer your application to millions of users..
Freedom? Why should I respect a private corporation? There is no obvious answer. Apple uses free open source tools working on other platforms but tries to force developers to buy Macs. I won't buy a Mac just to make a build.
<cite>@gouessej said:</cite> Freedom? Why should I respect a private corporation? There is no obvious answer. Apple uses free open source tools working on other platforms but tries to force developers to buy Macs. I won't buy a Mac just to make a build.

Yes, it massively limits your target market though.

@gouessej said: Freedom? Why should I respect a private corporation? There is no obvious answer. Apple uses free open source tools working on other platforms but tries to force developers to buy Macs. I won't buy a Mac just to make a build.

You can build on a windows machine with your open source tools. But you won’t have apple wiping your butt so it’ll take you more time and freedom than spending the bucks on the Mac. At least for me, maybe I’m too expensive or too slow in tweaking and setting up hard- and software ^^ As @zarch said, you deliberately limit your market to all other “freedom lovers”. What you want exists, its not even a utopia anymore so theres no need to explain how a reality could look, the reality is right before you and has 10% market share (18 surveys say that ;)).

@normen said: the reality is right before you and has 10% market share (18 surveys say that ;)).
Just made me think to this :D
1 Like
@nehon said: Just made me think to this :D

Right, 87 it was :wink:

<cite>@gouessej said:</cite> Apple uses free open source tools working on other platforms but tries to force developers to buy Macs. I won't buy a Mac just to make a build.

While I generally agree on Apples walled-garden policy and the criticism aimed at that, I doubt that the market share of developer machines is the driving motivation behind Apple’s toolchain setup.
I think they’re more after getting developers to agree to their terms of service, and after knowing who they are and what they do. Both can be used to discipline developers, for the better or the worse.

<cite>@zarch said:</cite> Yes, it massively limits your target market though.
My game works under Mac OS X too but not on iOS and the market doesn't interest me, I have nothing to sell.
<cite>@normen said:</cite> You can build on a windows machine with your open source tools. But you won't have apple wiping your butt so it'll take you more time and freedom than spending the bucks on the Mac. At least for me, maybe I'm too expensive or too slow in tweaking and setting up hard- and software ^^ As @zarch said, you deliberately limit your market to all other "freedom lovers". What you want exists, its not even a utopia anymore so theres no need to explain how a reality could look, the reality is right before you and has 10% market share (18 surveys say that ;)).
I don't limit myself to freedom lovers but I won't start a debate about what "freedom" means.

But if you were targetting ios requiring people to jailbreak their phone would be an issue for many…

@gouessej said:I don't limit myself to freedom lovers but I won't start a debate about what "freedom" means.
For you its not freedom for control freaks who want to improve your computing experience obviously ^^
<cite>@normen said:</cite> For you its not freedom for control freaks who want to improve your computing experience obviously ^^
Steve Jobs learned computer science by tinkering but refuses this freedom to Mac users. IMHO improving computing experience is a pretext. I could elaborate but it would be off topic and I don't want to offend anyone with my political views. I met Richard Stallman at the FOSDEM 2013, I'm against software patents and closed source software, I defend the collectivist cooperative global patronage and the self-management, I fight against planned obsolescence. When people speak to me about the market, I just think it is not my problem and it isn't a part of my solution. I have no game to sell, I understand that we have different views and opinions. I don't target iOS yet because it would require me to give some money to Apple which is too much for me and I think the only legitimate application store is Internet, not these closed gardens. I understand that some of you are interested in earning a lot of money by putting their games into the App Store, which isn't my objective.
@gouessej said: Steve Jobs learned computer science by tinkering but refuses this freedom to Mac users. IMHO improving computing experience is a pretext. I could elaborate but it would be off topic and I don't want to offend anyone with my political views. I met Richard Stallman at the FOSDEM 2013, I'm against software patents and closed source software, I defend the collectivist cooperative global patronage and the self-management, I fight against planned obsolescence. When people speak to me about the market, I just think it is not my problem and it isn't a part of my solution. I have no game to sell, I understand that we have different views and opinions. I don't target iOS yet because it would require me to give some money to Apple which is too much for me and I think the only legitimate application store is Internet, not these closed gardens. I understand that some of you are interested in earning a lot of money by putting their games into the App Store, which isn't my objective.

The open “play store” proved the walled garden concept right a few times over, especially in the “pretexts” (viruses, software quality, user experience). Not much of it is about open or closed software, in fact most of OSX is open (BSD). I agree about planned obsolescence but I like the twist apple puts on it, you don’t get a broken product, quite the contrary. My old iPhone 3G still works fine for my g/f (including the battery and everything else) …but ofc she wants a HD cam too now :slight_smile:

If you talk about the demand for running software from 2013 on hardware from 2005, well, I guess then I’d have to disagree completely, thats always nonsense. And finally… Apple didn’t bribe computer manufacturers to get their OS on computers like MS did back then, they just showed the world how nice computing can be if you just let them handle it for you. Just like Linux showed that you can very well run the whole internet on collaboratively developed software.

It was always your decision. No tricks, no lies, no changes in policy since the time being an outsider to today and being the market leader. I don’t get what the issue is that people have with Apple… I am happy that the market leader is now the “closed”, properly working system and the options are the open and experimental systems, not vice versa as before.

Richard Stallman is extreme. He might be right with some things but more on a philosophical plane. All or nothing is not an option, he’s not offering solutions but basically a religion. And not everybody is fine with spending his life in front of a computer screen to be “free” like he is :wink:

<cite>@normen said:</cite> Richard Stallman is extreme. He might be right with some things but more on a philosophical plane. All or nothing is not an option, he's not offering solutions but basically a religion. And not everybody is fine with spending his life in front of a computer screen to be "free" like he is ;)
His role isn't to offer all-inclusive "ready to use" solutions (even though he helps a lot), this is my role as an activist and an ideologist.
@gouessej said: His role isn't to offer all-inclusive "ready to use" solutions (even though he helps a lot), this is my role as an activist and an ideologist.
Apples role isn't providing the impossible (namely an "open" apple experience), thats your role as a geek.

Let me give you an example. Somebody told me once I pay too much for my Mac plus all that audio software, when I get a 300$ PC and install Linux I can install all kinds of audio software for free… All good and dandy but what software do I use? What file formats do I save in? Can they be used in all applications or will I have to tell a client he has to wait 4 hours for my software to convert stuff? Will I be able to load these files I made or keep the workflow I built for myself? Who knows. If I wanted to know I’d have to spend time in which I could earn the money to just pay others to do that for me, like for example… Apple? ^^ With them I unpack the mac, click on “Install Logic Pro” in the App Store and start working. 1 hour tops. Thats what I call freedom.

Note I don’t complain that not everybody does it like this, I’m fine they do but I don’t buy their experimental hard/software combinations anymore. But I will get verbal when I hear dense comments like “Apple should be more open”. Thats in the range of “iOS should get a new user interface, this ones 6 years old” and just plain shows how distorted the perception of those who say such things is.

Apple was “open” for a while, they almost died from it. Now they are not and they soar. Do you seriously think anyone who can control these things would remotely consider what you say with this data at hand? Quite the contrary, everybody tries to do the same but fails to see that its really about the product at apple and the shop etc. is just lucrative side effects. As I say, thinking about a utopia is nice but if we’re at that already I can imagine nicer utopias than “everybody has to do it the same way”. Computers weren’t invented in russia, they were invented by rich kid geniuses with resources ^^