iphonemacosgcccross-compiling

compile c code on mac for use on iphone?


How would I go about setting everything up to cross compile from my OSX 10.6 Macbook pro with xcode to my jailbroken 4th generation iPod touch. I'm mainly aiming to be able to port open source libraries to iphone. I can't seem to find any good/recent articles on cross compiling for iOS 4.


Solution

  • If you think about it, all projects built in XCode are cross-compiled for the iPhone. All you have to do is open an ios project, include your sources and build it.

    More specifically, when you have a project in XCode, in the Build Settings tab there is an option for you to specify the architecture to compile - this is automatically set to something like 'armv7' for ios projects.