compiling opencv 2.4 on a 64 bit mac in Xcode
- by Walt
I have an opencv project that I've been developing under ubuntu 12.04, on a parellels VM on a mac which has an x86_64 architecture. There have been many screen switching performance issues that I believe are due to the VM, where linux video modes flip around for a couple seconds while camera access is made by the opencv application. I decided to moved the project into Xcode on the mac side of the computer to continue the opencv development. However, I'm not that familiar with xcode and am having trouble getting the project to build correctly there.
I have xcode installed.
I downloaded and decompressed the latest version of opencv on the mac, and ran: ~/src/opencv/build/cmake-gui -G Xcode .. per the instructions from willowgarage and various other locations.
This appeared to work fine (however I'm wondering now if I'm missing an architecture setting in here, although it is 64-bit intel in Xcode).
I then setup an xcode project with the source files from the linux project and changed the include directories to use /opt/local/include/... rather than the /usr/local/include/...
I switched xcode to use the LLVM GCC compiler in the build settings for the project
then set the Apple LLVM Dialog for C++ to Language Dialect to GNU++11 (which seems possibly inconsistant with the line above)
I'm not using a makefile in xcode, (that I'm aware of - it has its own project file...)
I was also running into a linker issue that looked like they may be resolved with the addition of this linker flag:
-lopencv_video
based on a similar posting here: other thread
however in that case the person was using a Makefile in their project.
I've tried adding this linker flag under "Other Linker Flags" in xcode build settings but still get build errors.
I think I may have two issues here, one with the architecture settings when building the opencv libraries with Cmake, and one with the linker flag settings in my project.
Currently the build error list looks like this:
Undefined symbols for architecture x86_64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
_main in main.o
"cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
_main in main.o
"cv::Mat::deallocate()", referenced from:
cv::Mat::release() in main.o
"cv::Mat::copySize(cv::Mat const&)", referenced from:
cv::Mat::Mat(cv::Mat const&)in main.o
cv::Mat::operator=(cv::Mat const&)in main.o
"cv::Mat::Mat(_IplImage const*, bool)", referenced from:
_main in main.o
"cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)", referenced from:
_main in main.o
---SNIP---
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Can anyone provide some guidance on what to try next?
Thanks,
Walt