How does Marmalade SDK cross compiler work?
Asked Answered
I

3

6

Marmalade SDK is a cross-compiler, cross-platform framework that allows one to develop Iphone applications from Windows. Marmalade has a cross-compiler that is able to generate valid signed IPAs directly from a local windows computer without requiring a Mac or a remote build service. I know of some "open toolchains" that are able to cross-compile applications but these toolchains are not compatible with Iphone licensing. Anyone has any idea of how Marmalade's cross-compiler works? How did marmalade develop a cross-compiler that is compatible with Iphone SDK licensing? What compiler do they use to cross-compile? Did they use an open source compiler and customized it? How do they link with a "portable-OS-wrapper" that is compatible with Iphone licensing?

Ipswich answered 10/9, 2012 at 19:36 Comment(2)
What do you mean by work? What exactly do you want to know?Frijol
It also uses a cross-toolchain - I suspect they revere engineered Xcode's code signing process and use it to generate IPAs provided a developer has a valid signing identity.Whereon
G
5

Marmalade is like a virtual OS.

It generates code that targets Marmalade ARM or x86 So code created on Windows targets Marmalade and does not know anything about iOS.

Marmalade code can't call OS directly. It can call EDK extensions only.

EDK extension provides interface for Marmalade and implementation for a set of Platforms: iOS, Android, Windows, etc

Marmalade has loaders for each platform. Loader loads Marmalade code that is same for iOS, Android, Bada and other ARM platforms

iOS loader is close source compiled object by Marmalade team on iOS.

EDK extensions for iOS and iOS Loader are compiled in XCode on Mac.

Grey answered 16/9, 2012 at 20:24 Comment(7)
Are you sure that custom application code is loaded outside the core application and not linked directly with it? How do you know?Ipswich
BTW Windows apps made with Marmalade has EXE loader and code in .s86 file that is loaded by loader as DLL (dynamic link library). There is no big difference how to link to code statically or dynamically.Grey
Apple does not allow to load 3rd party dynamically linked libs. So everything linked statically for iOS in Marmalade Deployment Tool.Grey
Max is it possible to chat a little bit more with you? Your answers provide quite an insight. You are saying basically that: 1) IOS code is compiled in xcode as a main library. 2) there is a cygwin port of gcc that is used to compile and link custom code against the base.Ipswich
1. iOS code compiled as EDK extensions and Loader. Loader is part of marmalade. You can't create your own loader. But you can create your own EDK extensions. There is EDK extensions to access In-Apps, Camera, etc. 2. There is GCC. I am not sure if it is cygwin or mingw or own port that targets Marmalade environment. EXTRA: Marmalade has most iOS frameworks with stub functions. e.g. %Marmalade_ROOT%\6.0.6\s3e\deploy\plugins\iphone\sys_libs\System\Library\Frameworks\GLKit.framework\GLKit It is not real code from Apple but code required to link app on windowsGrey
Hi Max. I would like to do something similar for an open source cross-platform mobile engine. Ideally I would like to develop on windows and then build automatically IPAs and Apk.Ipswich
I also had such idea but it is too complex to reproduce full stack for one man. (Marmalade clone/way) One man can make some simpler solution. In fact I am not sure if iOS developers are interested in open source engines. Most engines are dead. I think many developer would love to pay 10-100 license fee for supported engine without logo at startup. I think I saw someone on alternative marmalade forum willing to make marmalade clone already.Grey
F
2

What I know is Marmalade uses GCC compiler to compile the code to ipa. While deploying the build, Marmalade uses the certificates and keys in your Marmalade certificates folder. DrMop explains the certificates generation using key from Marmalade and Provision profiles from Apple's provisioning portal.

In the Deploy tool, all the bin files, compiled extensions, certificates and provisioned are merged and archived into ipa file. I don't think Marmalade has made the ipa creation technique public yet.

Frijol answered 16/9, 2012 at 12:34 Comment(2)
You didn't address the "linking issue" that is the most important of all.Ipswich
What exactly do you want to know about "Linking"?Frijol
M
1

I'm not familiar with Marmelade specifically but there is not much proprietary in generating iOS code. LLVM/Clang as well as GCC are open source compiler environment and as such anybody could compile ARM code in objective C on almost any platform. The SDK however would have to be present to be able to include the header files and the frameworks to link agains them.

The code signing process at the end is just simple code signing. So as long as you have your Apple ID and code signing key stuff ready, its doable.

The complexity of all this is the same as if you would run a cross compiler on Platform X to compile code for Platform Y. The complexity might be to find out the specifics of the files around an application bundle such as the Entitlements.plist, the code signature's exact format etc. An IPA file at the end is a ZIP file of a directory containing the code, the resources, the signature and some other information such as the main Info.plist. So technically this can be done under any platform. If its practical or easy to maintain, is a completely other story.

Other options of course could be to simply use a virtual machine and then use your own byte code to run in this VM. Developer license agreements might exclude that if I remember correctly but if that clause is legally enforcable is another story. I know a few examples which break that rule such as a C64 or Atari game emulator (they are emulating the original CPU of those machines after all so a perfect example of a virtual machine).

My recommendation would be that if you do any serious IOS development, then do it on a Mac. Anything else would mean in case of trouble you would not get any support and it would be very difficult to find the correct answers. So you end up wasting more time that what its worth doing the same in Xcode with the expense of buying a mac (which at the same time can also be your windows and linux machine).

Maraschino answered 20/9, 2012 at 12:18 Comment(1)
PS talking about Linking, your cross compiler tools would of course need to be able to crete Mach-O binaries, not the usual ELF binaries as under Linux. Getting GCC to produce Mach-O is quite a hack. LLVM/Clang is the way better choice there.Maraschino

© 2022 - 2024 — McMap. All rights reserved.