Monday, September 24, 2012

mexopencv compile error in MacOSX 10.8

I had the following error message, at the end of this post, when I installed the mexopencv on my MacOSX 10.8 with Xcode 4.5, opencv installed from macports, and config_pkg properly installed.

First of all, I grab the patch from the following link to connect Matlab mex with Xcode,

https://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/

Second, I modify the MACOSX_DEPLOYMENT_TARGET=10.5 into 10.6 or higher.

After these steps, you should be able to compile and enjoy the mexopencv. 

PS: website of mexopencv, (many thanks to kota)
http://www.cs.sunysb.edu/~kyamagu/mexopencv/

/Applications/MATLAB_R2012a.app/bin/mex -c -cxx -largeArrayDims -Iinclude -I/opt/local/include/opencv -I/opt/local/include   src/MxArray.cpp -outdir lib
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available
/opt/local/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/opt/local/include/opencv2/flann/params.h:87:   instantiated from here
/opt/local/include/opencv2/flann/params.h:87: error: explicit instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]' but no definition available

   mex: compile of ' "src/MxArray.cpp"' failed.

make: *** [lib/libMxArray.a] Error 1

3 comments:

  1. Hi, I did what you said, I modified the the MACOSX_DEPLOYMENT_TARGET =10.5 into 10.6 in mexopts.ch.But it still does't work. This kind of problem still exsits.

    usr/include/opencv2/flann/params.h: In instantiation of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]':

    Could you help me, where to do change the the MACOSX_DEPLOYMENT_TARGET. Thanks a lot!!!!!

    ReplyDelete
  2. Casino City - Dr. Majestic Casino & Hotel
    Dr. Majestic Casino 여수 출장마사지 & Hotel is a luxury hotel and casino located 전라남도 출장마사지 in the heart of Las 광양 출장마사지 Vegas. It is adjacent 시흥 출장샵 to the Miracle Mile Casino 광명 출장샵 and Casino.

    ReplyDelete