OSX indigo opencv linking problem (cv_bridge, image_view)
I'm trying to install indigo from source on a mac recently upgraded to yosemite (10.10). I've had a few issued but managed to build everything up to cv_bridge. cv_bridge has a linking error with opencv:
Linking CXX shared library /.../devel_isolated/cv_bridge/lib/python2.7/site-packages/cv_bridge/boost/cv_bridge_boost.so
Undefined symbols for architecture x86_64:
"cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
NumpyAllocator::allocate(int, int const*, int, int*&, unsigned char*&, unsigned char*&, unsigned long*) in module_opencv2.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/.../devel_isolated/cv_bridge/lib/python2.7/site-packages/cv_bridge/boost/cv_bridge_boost.so] Error 1
make[1]: *** [src/CMakeFiles/cv_bridge_boost.dir/all] Error 2
make: *** [all] Error 2
Based on some older answers, it looked like this was a libc++ vs libstdc++ issue ( http://answers.ros.org/question/95056... ), so after adding:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libstdc++")
cv_bridge compiled fine, as did everything up to image_view. image_view also had an opencv linking error:
Linking CXX executable /.../image_view/lib/image_view/disparity_view
Undefined symbols for architecture x86_64:
"cv::imwrite(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
... many more opencv missing symbols ...
Making the same change to CMakeLists for image_view, however, causes linking error to ros core libraries:
Linking CXX executable /.../image_view/lib/image_view/disparity_view
Undefined symbols for architecture x86_64:
"ros::init(int&, char**, std::string const&, unsigned int)", referenced from:
_main in disparity_view.cpp.o
I must be missing something here as it seems other people are having success with indigo on OSX. Also, just to be clear, I have opencv 2.4.5 from homebrew-science. Any help is appreciated. Thanks!