Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cross compiling c++ to iphone arm

I've scanned over the (outdated) article that is the first hit on google about ARM cross-compiling. I've also seen the article about compiling OpenCV to the iPhone and the general cross compiling instructions there. My question is can I call the apparently already configured gcc/g++ in the iPhone developer package (which I already have installed) like in the latter article? A lot of the OpenCV stuff seems superfluous to my needs.

If I can, what would the calls look like? Should I create a Makefile to make things easier?

Also, I need -lncurses library. Can I call them like normal, or do I need to specify it's path because I'm not calling the default gcc/g++?

like image 360
helloandre Avatar asked Feb 16 '09 07:02

helloandre


People also ask

Can GCC cross compile?

GCC, a free software collection of compilers, can be set up to cross compile. It supports many platforms and languages. Cross-compiling GCC requires that a portion of the target platform's C standard library be available on the host platform.

Why is cross compiling so hard?

"building a cross-compiler is significantly harder than building a compiler that targets the platform it runs on." The problem exists due to the way libraries are built and accessed. In the normal situation all the libraries are located in a specific spot, and are used by all apps on that system.


2 Answers

If you're using the official SDK, compiling C++ for the iPhone is as simple as including cpp files in your project and hitting "build". Of course you can still go in and tweak the compiler switches - well, most of them.

As for ncurses, I'm not sure why you'd want to use that - but the only limitation you should have is that you can't link against dynamic libraries - so you'd have to linked the object code in.

like image 127
philsquared Avatar answered Nov 07 '22 15:11

philsquared


A script that you can use as a basis for crosscompiling your libraries for iOs development.

like image 23
Simon Epskamp Avatar answered Nov 07 '22 15:11

Simon Epskamp