Ask Your Question
0

OpenCV for iOS - Linking Libraries in Xcode

asked 2015-08-11 09:17:31 -0600

MdK8 gravatar image

Hi,

as part of a team project I intend to implement obstacle detection for a robot using open cv. I am now at a point where I have functional code that runs on OS X and uses my laptop camera to detect obstacles approaching it. However the robot runs iOS (it is an iPad at heart) and thus requires me to build for iOS. Obviously the linker now doesn't accept the OS X library files, because of architecture mismatches. So far it is set up as follows:
1. /usr/local/lib added to Library Search Paths
2. /usr/local/include added to Header Search Paths
3. c++ language dialect changed to C++11
4. Libraries added to Other Linker Flags ( -lopencv_calib3d etc.)
5. Valid Architectures set to i386,x86_64

In order to perform the necessary modifications for iOS I first of all changed the valid architectures to armv7, armv7s, and arm64. Then I attempted to follow the instructions on OpenCV:Installation in iOS, asking me to execute the opencv/platforms/ios/build_framework.py script. This built a framework file which I added to my Xcode project via Build Phases -> Link Binary With Libraries. According to the python script's readme "The script builds OpenCV.framework for iOS. The built framework is universal, it can be used to build app and run it on either iOS simulator or real device." However when I try to build the product for iOS simulator (amongst others), I get uncountable Undefined symbols for architecture x86_64 linker errors. As far as I am aware there is nothing else to the installation instructions linked above though.

Am I missing something here? Adjusting header/library search paths to include either nothing or the OS X OpenCV library files from /usr/local/lib was to no avail. My intuition is that is has something to do with the folder build inside of the folder that contains the opencv2.framework file. The contents of build are the folders:
iPhoneOS-arm64
iPhoneOS-armv7
iPhoneOS-armv7s
iPhoneSimulator-i386
iPhoneSimulator-x86_64

These in turn are comprised of:
iPhoneOS-arm64 contents

Do I need to link any part of these folders into my project?

I am grateful for any advice.

Warm regards,
Mark

edit retag flag offensive close merge delete

Comments

i have the same problem.

liwei gravatar imageliwei ( 2015-08-20 22:46:40 -0600 )edit

I am also having the same issue, does anybody know?

AlecTheLion gravatar imageAlecTheLion ( 2016-04-06 10:51:15 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-08-21 21:52:41 -0600

I'm also having the same problem. Does anybody have a solution for this problem?

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-08-11 09:17:31 -0600

Seen: 1,904 times

Last updated: Aug 11 '15