Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rock6079

macrumors 6502
Original poster
Jan 6, 2004
428
149
does anyone know if it is possible to compile iphone apps through the terminal, possibly using g++ or gcc or some other command? if so, how would one do this.

basically I have my full application source code and want to compile it without having XCode installed or at least without launching and compiling through XCode. Is this possible?

Thanks!
 

bredell

macrumors regular
Mar 30, 2008
127
1
Uppsala, Sweden
Sure, but you still need to have the iPhone SDK installed. Just create a Makefile, make sure that you point out the relevant frameworks you want to use and set the architecture with the "-arch" option. If you compile with "-arch i386" you get a binary that you should be able to run in the iPhone Simulator, and if you compile with "-arch armv6" you get a native binary. But I'm not sure how you would get that binary installed on a real iPhone device.

When I create libraries from the command line I compile for both architectures and use the "lipo" command to create a fat binary, that way I get a library that works both in the simulator and on a real device.
 

rock6079

macrumors 6502
Original poster
Jan 6, 2004
428
149
Sure, but you still need to have the iPhone SDK installed. Just create a Makefile, make sure that you point out the relevant frameworks you want to use and set the architecture with the "-arch" option. If you compile with "-arch i386" you get a binary that you should be able to run in the iPhone Simulator, and if you compile with "-arch armv6" you get a native binary. But I'm not sure how you would get that binary installed on a real iPhone device.

When I create libraries from the command line I compile for both architectures and use the "lipo" command to create a fat binary, that way I get a library that works both in the simulator and on a real device.

thx both of you.
is there ANY possible way to do this without having iPhone SDK installed?

a side note to bredell: uppsala, sweden: what an awesome and fun university city to go party in. man, i miss my days in sweden/denmark!
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
thx both of you.
is there ANY possible way to do this without having iPhone SDK installed?

a side note to bredell: uppsala, sweden: what an awesome and fun university city to go party in. man, i miss my days in sweden/denmark!

I don't see how. The headers for the iPhone library's won't be there without the SDK.
 

rock6079

macrumors 6502
Original poster
Jan 6, 2004
428
149
Why don't you install it?

long story short, i am sending an un-compiled but ready to go app to a client who wants to compile it themselves :)confused:), but does not have XCode/iPhone SDK installed.

So my plan was to build a quick application in RB or XCode that would allow them to click build and run the code through the terminal and produce the built app.

Of course, the simple solution is to have them install XCode/iPhone SDK, but what I am asking for would be the ideal/less-confusing solution for the client, which I would prefer to provide.
 

skunkworker

macrumors regular
Sep 9, 2007
182
20
long story short, i am sending an un-compiled but ready to go app to a client who wants to compile it themselves :)confused:), but does not have XCode/iPhone SDK installed.

So my plan was to build a quick application in RB or XCode that would allow them to click build and run the code through the terminal and produce the built app.

Of course, the simple solution is to have them install XCode/iPhone SDK, but what I am asking for would be the ideal/less-confusing solution for the client, which I would prefer to provide.

Installing Xcode/iPhone SDK puts all of the pieces in the right places, gcc4.2clang, and a ton of the frameworks, you need to install xcode/iphone sdk. If you are just testing out the application for viewing purposes look into sending just the iphone simulator build as it is not encrypted at all. And having them install it.
 

firewood

macrumors G3
Jul 29, 2003
8,108
1,345
Silicon Valley
long story short, i am sending an un-compiled but ready to go app to a client who wants to compile it themselves :)confused:), but does not have XCode/iPhone SDK installed.

So my plan was to build a quick application in RB or XCode that would allow them to click build and run the code through the terminal and produce the built app.

The compilers and libraries needed to build from the command line are only (easily) available in the iPhone SDK. The compiler that comes with the Mac doesn't compile for ARM. The libraries and frameworks that come with a stock Mac (or linux boxen) don't include UIKit.

Maybe you want to look in some other forum for info on a jailbroke toolchain?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.