# Revision history [back]

### Specify libc++ when compiling/linking OpenCV for MacOSX 10.8

I'm trying to set up an automated build system for OpenCV 2.4.8 (downloaded from the OpenCV site) to link it into a parent project. I'm roughly following the instructions for building here: https://sites.google.com/site/yonasstephenfyp2013/updates/tutorialinstallingopencvonmacosxmountainlion

Unfortunately my build machine is running MacOSX 10.8 and I am running 10.9 locally and it seems the default clang C++ library has changed between the two from libstdc++ (see here: http://stackoverflow.com/questions/19637164/c-linking-error-after-upgrading-to-mac-os-x-10-9-xcode-5-0-1)

My parent project is set to use libc++ (this is configures in XCode). Combined with the clang default of libc++ on 10.9 this works fine on my machine. BUT it's causing a bunch of linker errors on my build machine basically not finding the std library). I would therefore like to tell OpenCV to build with libc++. Is there any way of doing this with CMake options?? I have tried passing DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY="libc++" -DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD="c++0x" -DCLANG_CXX_LIBRARY="libc++" -DCLANG_CXX_LANGUAGE_STANDARD="c++0x" but CMake informs me these are ignored:

CMake Warning:
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]   Manually-specified variables were not used by the project:
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CLANG_CXX_LANGUAGE_STANDARD
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CLANG_CXX_LIBRARY
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY


Is there any other way I can fix this? Perhaps changing the CXX_COMPILER_FLAGS??

I don't think switching the project to libstdc++ will work either - I don't think I'll be able to build it locally on my machine then.

### Specify libc++ when compiling/linking OpenCV for MacOSX 10.8

I'm trying to set up an automated build system for OpenCV 2.4.8 (downloaded from the OpenCV site) to link it into a parent project. I'm roughly following the instructions for building here: https://sites.google.com/site/yonasstephenfyp2013/updates/tutorialinstallingopencvonmacosxmountainlion

Unfortunately my build machine is running MacOSX 10.8 and I am running 10.9 locally and it seems the default clang C++ library has changed between the two from libstdc++ (see here: http://stackoverflow.com/questions/19637164/c-linking-error-after-upgrading-to-mac-os-x-10-9-xcode-5-0-1)

My parent project is set to use libc++ (this is configures configured in XCode). Combined with the clang default of libc++ on 10.9 this works fine on my machine. BUT it's causing a bunch of linker errors on my build machine basically not finding the std library). I would therefore like to tell OpenCV to build with libc++. Is there any way of doing this with CMake options?? I have tried passing DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY="libc++" -DCMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD="c++0x" -DCLANG_CXX_LIBRARY="libc++" -DCLANG_CXX_LANGUAGE_STANDARD="c++0x" but CMake informs me these are ignored:

CMake Warning:
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]   Manually-specified variables were not used by the project:
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CLANG_CXX_LANGUAGE_STANDARD
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CLANG_CXX_LIBRARY
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD
[13:54:00][OpenCV-Mac-Static-Libs (BUILD)]     CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY


Is there any other way I can fix this? Perhaps changing the CXX_COMPILER_FLAGS??

I don't think switching the project to libstdc++ will work either - I don't think I'll be able to build it locally on my machine then.