2
votes

I'm missing something minor here in my project using the OpenCV framework from a working demo.

Steps to reproduce:

  1. Download the example app from http://aptogo.co.uk/2011/09/opencv-framework-for-ios/

  2. Create a new Titainum iOS module with titanium create --platform=iphone --type=module --dir=. --name=opencv --id=opencv

  3. Open the XCode project, drag in the OpenCV framework from the FaceTracker app and the other required frameworks.

  4. Add OTHER_LDFLAGS=$(inherited) -framework OpenCV to module.xcconfig

  5. Create new TiUIView and TiUIViewProxy classes named OpencvView and OpencvViewProxy.

  6. In the new OpencvView class, instantiate a UIViewController that uses OpenCV.

The build will build the Titanium module, but when I try to run the module test harness, I get these errors for OpenCV objects:

Undefined symbols for architecture i386: "_CMSampleBufferGetImageBuffer", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CMSampleBufferGetOutputPresentationTimeStamp", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CMTimeMake", referenced from: -[VideoCaptureViewController createCaptureSessionForCamera:qualityPreset:grayscale:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferGetBaseAddress", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferGetBaseAddressOfPlane", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferGetHeight", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferGetPixelFormatType", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferGetWidth", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferLockBaseAddress", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "_CVPixelBufferUnlockBaseAddress", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from: -[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:] in libopencv.a(DemoVideoCaptureViewController.o) "cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from: -[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:] in libopencv.a(DemoVideoCaptureViewController.o) "cv::CascadeClassifier::load(std::string const&)", referenced from: -[DemoVideoCaptureViewController viewDidLoad] in libopencv.a(DemoVideoCaptureViewController.o) "cv::CascadeClassifier::CascadeClassifier()", referenced from: -[DemoVideoCaptureViewController .cxx_construct] in libopencv.a(DemoVideoCaptureViewController.o) "cv::CascadeClassifier::~CascadeClassifier()", referenced from: -[DemoVideoCaptureViewController .cxx_destruct] in libopencv.a(DemoVideoCaptureViewController.o) "cv::Mat::deallocate()", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) -[UIImage(UIImage_OpenCV) CVMat] in libopencv.a(UIImage+OpenCV.o) -[UIImage(UIImage_OpenCV) CVGrayscaleMat] in libopencv.a(UIImage+OpenCV.o) "cv::Mat::create(int, int const*, int)", referenced from: -[UIImage(UIImage_OpenCV) CVMat] in libopencv.a(UIImage+OpenCV.o) -[UIImage(UIImage_OpenCV) CVGrayscaleMat] in libopencv.a(UIImage+OpenCV.o) "cv::flip(cv::_InputArray const&, cv::_OutputArray const&, int)", referenced from: -[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:] in libopencv.a(DemoVideoCaptureViewController.o) "cv::resize(cv::_InputArray const&, cv::OutputArray const&, cv::Size, double, double, int)", referenced from: -[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:] in libopencv.a(DemoVideoCaptureViewController.o) "cv::fastFree(void*)", referenced from: -[VideoCaptureViewController captureOutput:didOutputSampleBuffer:fromConnection:] in libopencv.a(VideoCaptureViewController.o) -[UIImage(UIImage_OpenCV) CVMat] in libopencv.a(UIImage+OpenCV.o) -[UIImage(UIImage_OpenCV) CVGrayscaleMat] in libopencv.a(UIImage+OpenCV.o) "cv::transpose(cv::_InputArray const&, cv::_OutputArray const&)", referenced from: -[DemoVideoCaptureViewController processFrame:videoRect:videoOrientation:] in libopencv.a(DemoVideoCaptureViewController.o) "_kCVPixelBufferPixelFormatTypeKey", referenced from: -[VideoCaptureViewController createCaptureSessionForCamera:qualityPreset:grayscale:] in libopencv.a(VideoCaptureViewController.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2
Are you trying to build for the simulator? I suspect the framework you have downloaded is only built for ARM processors.Aurelius
I'm starting to think that too. But, I tried to use the module in Titanium Studio and install directly to the device. I got the same type of "SystemExit: 65" error. Is it possible to develop a Ti iOS module that employs a framework only build for the device?Joe Beuckman
Hi Joe, did you solve this? I am facing the very same problem when building for Titanium Appcelerator. The module builds correctly, but when I try to compile and run the App, I get this error.gbossa

2 Answers

0
votes

I had a similar problem with the default apple llvm compiler on Xcode 4.5.1. Try changing it to gcc (from your build options) and see if this works.

1
votes

I have similar errors. And just changing "build setting" does not help.

Finally, I solved this problem by adding some framework like coreMedia, coreVideo, etc. These frameworks, however, are not used in my code.

So I guess openCV needs these frameworks. But I don't know why.

Hope this will help:)