opencv for ios 5.1 (on OS X 10.8) with boost using c++11 and libc++
In the process of adding boost 1.5.1 to my ios project, I encountered an incompatibility due to C++ Standard Library conflicts, e.g.:
Undefined symbols for architecture armv7: "std::__1::locale::use_facet(std::__1::locale::id&) const"
since my boost build via galbraithjosephs-boostoniphone compiles with the following options:
-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -std=c++11 -stdlib=libc++
and it appears that the OpenCV 2.4.9 CMake build compiles with gnu++11 and libstdc++. I'm compiling an OpenCV framework with the included build script as follows:
python2.7 opencv/ios/build_framework.py ios
At this point my plan is to try to rebuild my OpenCV framework with the c++11 compiler and libc++ standard library as in the boost build, and then update all of my XCode libraries and applications appropriately.
The following link aimed at OpenCV 2.4.2 OpenCV with C++11 on OS X 10.8 seems to be a good starting point, and it essentially suggests modifying CMakeLists.txt with the following entries:
message("Setting up Xcode for C++11 with libc++.")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
but after modifying the opencv/CMakeLists.txt file in the first step my build fails with the following message:
/Volumes/ramdisk/opencv/modules/core/src/arithm.cpp:444:51: error: constant expression evaluates to 4294967295 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
static int CV_DECL_ALIGNED(16) v64f_absmask[] = { 0xffffffff, 0x7fffffff, 0xffffffff, 0x7fffffff };
and I noticed that the output indicates that it is still using the GNU compiler. I see the message added above in the build output
Setting up Xcode for C++11 with libc++.
but the compiler and arguments are still listed as:
-- General configuration for OpenCV 2.4.9 =====================================
--
-- Platform:
-- Host: Darwin 12.0.0 i386
-- Target: iOS
-- CMake: 2.8.9
-- CMake generator: Xcode
-- CMake build tool: /opt/local/bin/cmakexbuild
-- Xcode: 4.4.1
--
-- C/C++:
-- Built as dynamic libs?: NO
-- C++ Compiler: /usr/bin/g++
-- C++ flags (Release): -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -Wno-c++11-narrowing -DNDEBUG -O3 -fomit-frame-pointer -ffast-math
-- C++ flags (Debug): -headerpad_max_install_names -fvisibility=hidden -fvisibility-inlines-hidden -Wno-c++11-narrowing
-- C Compiler: /usr/bin/gcc
-- C flags (Release):
-- C flags (Debug):
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: NO
--
If anyone has advice or a link for how to tune CMake accordingly it would be much appreciated. I would imagine opencv + boost are fairly common siblings for ios platforms.
EDIT: The build also reports a second error
/Volumes/ramdisk/opencv/modules/core/include/opencv2/core/operations.hpp:65:16: fatal error: 'ext/atomicity.h' file not found
#include <ext/atomicity.h>
The latest version # seems to be different for the two repositories sited on http://code.opencv.org/projects/opencv/wiki (that page suggests itseez is a mirror): (1) git://code.opencv.org/opencv.git => 2.4.9 grep -E "CV_.*_VERSION" ${OPENCV}/opencv/modules/core/include/opencv2/core/version.hpp
define CV_MAJOR_VERSION 2
define CV_MINOR_VERSION 4
define CV_SUBMINOR_VERSION 9
(2) git://github.com/itseez/opencv.git => 2.4.3 grep -E "CV_.*_VERSION" ${ITSEEZ}/opencv/modules/core/include/opencv2/core/version.hpp
define CV_MAJOR_VERSION 2
define CV_MINOR_VERSION 4
define CV_SUBMINOR_VERSION 3
Can someone explain or send a link that explains the difference between and reason for the two repositories? I'm guessing this is addressed somewhere but my searches have come up empty.