Feb 20, 2009

Universal i386/arm OpenCV framework for iPhone

I've managed to make working script to create universal OpenCV framework for i386/arm.
It's based on information from here and make_frameworks.sh script by Mark Asbach (here).
I've fixed linking errors that caused LambdaJive script to fail during ARM framework generation + fixed some issues I encountered using OpenCV framework on iPhone Simulator.

You'll need 2 files: make.sh and modified Makefile.in, which should be in root of OpenCV source tree.
Just cross fingers and run ./make.sh

Script works fine with OpenCV 1.1pre1. Created framework contains i386/arm libraries. If you need ppc versions - uncomment couple of lines in make.sh

Applications compiled with private OpenCV.framework work fine on iPhone Simulator (at least for face detection purposes), but I had no chance to test them on real HW yet .

To fix linking error:
ld: duplicate symbol _cvCompleteSymm in ./ml/src/.libs/lib_ml.a(ml_inner_functions.o) and ./cxcore/src/.libs/lib_cxcore.a(cxmatrix.o)

I just wrapped one of the duplicated functions (the one in ml_inner_functions) with #if 0 to please the linker. Apart from having same names these 2 functions seem to have almost identical code, so wrapping one of them shouldn't do much harm.

You will also need files OpenCV.h and Info.plist which should be put in autotools/darwin/. You can get them from OpenCV SVN here

UPDATE from 08/26/2009:
If you use SDK 3.0 - here's how to solve libstdc++ issue http://stackoverflow.com/questions/1095145/linking-static-libraries-in-iphone-sdk-3-0