I have the source code for my app... how do I compile it without access to a Mac?
March 15, 2011 8:20 PM   Subscribe

I have the source code for my app... how do I compile it without access to a Mac?

I used a third-party app developer website (buzztouch - awesome site) to built a quick-and-dirty iPhone app to show my boss the possibilities of using it for our organization, but haven't been able to figure out a way to compile it on the PC.

It's got a step-by-step instruction on how to compile it on xCode, and I tried to kludge it with a copy of adobe flash, but haven't been able to (unrecognized file type).

Anyone have any ideas?
Thanks.
posted by Seeba to Computers & Internet (15 answers total) 1 user marked this as a favorite
 
You can't do iOS development on a PC. If your organization does not use macs, maybe you should look into Android development rather than for iOS.
posted by demiurge at 8:35 PM on March 15, 2011


Response by poster: Hrm. Nertz. I guess I figured that compilation is basically just translating the code, and I'm somewhat surprised I couldn't find a way around - I thought that Adobe Flash's iphone packager could do it, but didn't know how to take the code I had and import it.
posted by Seeba at 8:43 PM on March 15, 2011


Best answer: Seeba, if you want I should be able to compile it for you. Send me a MeMail.

But, you won't be able to run it on a device unless you have an iOS developer license. On the Mac there is an iPhone simulator, which does you no good.
posted by 47triple2 at 8:46 PM on March 15, 2011


Refurbished Mac Mini's can be had for $600, but you'll need to provide the monitor, keyboard, and mouse.
posted by ikaruga at 10:14 PM on March 15, 2011


You could setup a hackintosh, check Lifehacker.
posted by stratastar at 10:16 PM on March 15, 2011


Best answer: TMI...

What you want to do is called "cross compiling". It's when you compile for a platform other than the one you're currently on. Theoretically, it is possible.

Here's the problem: different platforms use different object/executable/binary formats (ignoring VM formats like JVM and CIL). In the Windows world they use PE (which comes from an old Unix format, and is also used on EFI and UEFI). In the Apple world then use Mach-O. And almost everyone else -- Linux, Unixes, embeded devices -- use ELF.

ELF is probably the best understood and the easiest to cross compile for because Unix hackers really like writing tools for it. Aiding in this is that all of the libraries/headers you need to build a complete executable are freely available. Off hand I don't know, but I bet there's a Windows version of gcc that will compile ELF executables to run on Linux.

PE is the next best known because Windows has been using it forever. MS does make available a bare bones Windows SDK that you can compile to with other compilers. But there's only one cross compiler that I'm familiar with, and that's for people doing EFI and UEFI work on Macs and Linux. But I've never used it. In fact, what EFI work I did on Macs I compiled the executables on Windows using MSVC and copied them over.

Mach-O is the least known of the common formats. It only works on OS X, darwin, and NeXTStep (if you can even find NS). Apple controls it entirely and is free to change it whenever they feel like it. The compiler toolchain is all open source (gcc and LLVM) but Apple does not play well with others. In fact, the gcc folks gave up some time ago trying to make gcc work out of the box on OS X and demoted it to second class citizen status (Apple doesn't care, the future for them is LLVM anyway). Also, many of the libraries you need to link to aren't free. Notably, Foundation and UIKit are not open source or downloadable.

The path of least resistance here is to put down some money and buy a bare bones Mac.
posted by sbutler at 1:19 AM on March 16, 2011 [1 favorite]


In addition, IIRC, Adobe modified LLVM to compile Flash/ActionScript. Once it's in the LLVM intermediary format they can finish the compile to Mach-O on arm (which is the architecture for iOS devices). But they do this by limiting the iOS feature set that is available to Flash/ActionScript and -- I imagine -- re-implementing most of their custom Flash UI libraries to work on iOS.

So it works well enough for Flash/ActionScript, but is going to fall flat on its face when fed any other code. Including a legitimate iOS project that would compile just fine with Apple's toolchain.
posted by sbutler at 1:26 AM on March 16, 2011


Setting up even open-source cross-compiling toolchains is a nightmare scenario for most programmers. I've never even heard of somebody setting one up for the iOS walled garden. It might be theoretically possible. But... no offense, but if you're trying to import Objective-C code into Flash, then you're probably not going to be the person who does the original R&D to make it a reality.

You need a Mac. It's unfortunate. But, true.
posted by Netzapper at 6:25 AM on March 16, 2011


In case you want more options, you can fork over $500 for Mac OS X Server Edition and then install it on a virtual machine on your PC using Oracle VirtualBox. If you can figure out how to get a downloadable purchase of Mac OS X Server this may also be the fastest option.

VirtualBox offers full USB functionality with its virtual machines; I've used it to debug my Android apps in an Ubuntu virtual machine.
posted by asymptotic at 6:28 AM on March 16, 2011


Best answer: I just want to highlight an earlier comment about deployment. Even if you _did_ get it to compile, you still won't be able to put it on a device. All packages have to be "signed" by the developer and you have to tell Apple which devices you're testing on and embed those devices IDs in the actual application. It will only run on those devices afterwards. The device checks those signatures and makes sure it's on the list of authorized devices before letting you install it.

Your developer should be handling all this for you. They'll know all the details of this process because they have to do it for every app they test. If they're not helping you, they're being irresponsible. They have to know you can't do anything with just the source code and no Apple developer license. Plus, even if you went out and bought a Mac Mini today (which is a great choice for a cheap dev machine) you'd still have to get the whole Apple tool chain setup. It's not super hard, but it's a process designed for developers and it'll be a bit of a time sink even just to compile a project and deploy it. Took me at least a full day to work out all the pieces of it, even with someone in the office who'd done it before to help me out.

If your developer hems and haws about helping you with this, you might suggest they take a look at Testflight which helps manage some of these remote deployment issues and can install apps over the air. You still need to register the device with Apple, but it's a bit less obnoxious than having to send you .ipa files every time they update the app.
posted by heresiarch at 8:25 AM on March 16, 2011


(Quick addendum: I'm not suggesting you don't get your own tool chain setup eventually, just that there's no reason to drop $600+ dollars just to give your boss a demo. If your boss likes it, then you'll want to get a real dev setup and an engineer to build things. But until then, it's totally reasonable to ask your contractor to do all this for you.)
posted by heresiarch at 8:26 AM on March 16, 2011


but I bet there's a Windows version of gcc that will compile ELF executables to run on Linux.

That's kind of a misleading statement. gcc (and binutils, which provides the assembler and linker) fully supports both PE and ELF, so most versions of gcc that you find for Windows such as MinGW will be native. But gcc is inherently designed to separate the host from the target and to support building a cross compiler of most supported targets, so it's entirely possible using Cygwin to build a linux-targeted cross compiler that runs on Windows. It's also easy to build a PE-targeted cross gcc that runs on linux (apt-get install mingw32).
posted by Rhomboid at 1:10 PM on March 16, 2011


Oh, indeed. My point was only to clarify that gcc isn't just ELF and you can build gcc in any of the four combinations of host={Windows,Linux} target={Windows,Linux} (and dozens more, for that matter.)
posted by Rhomboid at 7:02 PM on March 16, 2011


Wait, why haven't the people who you PAID and WROTE the code given you a copy of the program. As developers they can give sign you up to get a copy of the program on your iOS device.
posted by stratastar at 8:16 PM on March 16, 2011


Response by poster: Thanks for all the assistance - - y'all are absolutely right, I'm fuzzy on the concept (but figure, like when I started writing webpages and building databases, I figure the best way to learn is to jump head-on in and do a whole lot of revisions...).

To clarify - I didn't pay anyone, I used a 3rd party developer who did the source code for free, figuring that I'd open it up, learn to read it, what everything did, then slowly start wonking with different features until I had a working knowledge of how everything worked (reading a book on it once I got smart enough to understand what was being said... that was a lifesaver after the first few weeks of playing with SQL and C++).

47triple2 kindly compiled the code, and I got the developer's license - - as it turns out, I needed to make some other corrections, so I'm borrowing a friend's mac to make the changes, and will keep going from there!

Thanks for the assistance and clarification,
Seeba
posted by Seeba at 8:38 AM on March 17, 2011


« Older I don't know about this egg situation...   |   Help! Newer »
This thread is closed to new comments.