Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Installing OpenCV in Mac Os X (10.9.1)

Dear all,

I recently upgraded my gcc compiler to version (4.8.2). After trying to install OpenCV (2.4.8), I get some compiler errors when building the opencv_video library. The way I'm building the OpenCV library is as follows:

cd opencv-2.4.8
mkdir release
cd release/
cmake -D CMAKE_CXX_FLAGS="-I/opt/local/includes -L/opt/local/lib" -D CMAKE_INSTALL_PREFIX="/opt/local" -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE=ON ..
make -j 4

The error message is given below and any feedback/suggestions are really welcomed :-) When following the same steps mentioned above for building the OpenCV library, but with using gcc 4.2.1, I didn't get any compilation problems and the library could be successfully installed.

"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles 
[ 42%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/video_init.cpp.o
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && /opt/local/bin/c++   -DCVAPI_EXPORTS -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -fPIC -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/perf -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/features2d/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/imgproc/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/flann/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/core/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/ts/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/test -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release -I/opt/local/include     -include "/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video/precomp.hpp" -Winvalid-pch  -o CMakeFiles/opencv_video.dir/src/video_init.cpp.o -c /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src/video_init.cpp
In file included from /System/Library/Frameworks/QTKit.framework/Headers/QTKit.h:51:0,
             from /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:46:
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ')' before '(' token
- (void)modernizeWithCompletionHandler:(void (^)(void))handler AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
                                          ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected identifier before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ';' before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: unknown property attribute before ',' token
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: expected ')' before ',' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:1: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
 ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: unknown property attribute before ',' token
 @property (atomic, assign) QTMovieModernizerStatus          status                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: expected ')' before ',' token
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual double CvCaptureCAM::getProperty(int)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:9: warning: declaration of 'width' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:25: warning: declaration of 'height' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
                     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual bool CvVideoWriter_QT::writeFrame(const IplImage*)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:1016:20: warning: declaration of 'imagedata' shadows a member of 'this' [-Wshadow]
 unsigned char* imagedata = (unsigned char*)argbimage->imageData;
                ^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library ../../lib/libopencv_video.dylib
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/opencv_video.dir/link.txt --verbose=1
/opt/local/bin/c++  -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -dynamiclib -Wl,-headerpad_max_install_names   -compatibility_version 2.4.0 -current_version 2.4.8 -o ../../lib/libopencv_video.2.4.8.dylib -install_name /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/lib/libopencv_video.2.4.dylib CMakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gaussmix2.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gmg.cpp.o CMakeFiles/opencv_video.dir/src/camshift.cpp.o CMakeFiles/opencv_video.dir/src/kalman.cpp.o CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o CMakeFiles/opencv_video.dir/src/motempl.cpp.o CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o CMakeFiles/opencv_video.dir/src/simpleflow.cpp.o CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o CMakeFiles/opencv_video.dir/src/video_init.cpp.o ../../lib/libopencv_core.2.4.8.dylib ../../lib/libopencv_imgproc.2.4.8.dylib ../../lib/libopencv_core.2.4.8.dylib 
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_symlink_library ../../lib/libopencv_video.2.4.8.dylib ../../lib/libopencv_video.2.4.dylib ../../lib/libopencv_video.dylib
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles  88
[ 42%] Built target opencv_video
make: *** [all] Error 2

Installing OpenCV in Mac Os X (10.9.1)

Dear all,

I recently upgraded my gcc compiler to version (4.8.2). After trying to install OpenCV (2.4.8), I get some compiler errors when building the opencv_video library. The way I'm building the OpenCV library is as follows:

cd opencv-2.4.8
mkdir release
cd release/
cmake -D CMAKE_CXX_FLAGS="-I/opt/local/includes -L/opt/local/lib" -D CMAKE_INSTALL_PREFIX="/opt/local" -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE=ON ..
make -j 4

The error message is given below and any feedback/suggestions are really welcomed :-) When following the same steps mentioned above for building the OpenCV library, but with using gcc 4.2.1, I didn't get any compilation problems and the library could be successfully installed.

"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles 
[ 42%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/video_init.cpp.o
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && /opt/local/bin/c++   -DCVAPI_EXPORTS -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -fPIC -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/perf -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/features2d/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/imgproc/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/flann/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/core/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/ts/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/test -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release -I/opt/local/include     -include "/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video/precomp.hpp" -Winvalid-pch  -o CMakeFiles/opencv_video.dir/src/video_init.cpp.o -c /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src/video_init.cpp
In file included from /System/Library/Frameworks/QTKit.framework/Headers/QTKit.h:51:0,
             from /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:46:
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ')' before '(' token
- (void)modernizeWithCompletionHandler:(void (^)(void))handler AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
                                          ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected identifier before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ';' before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: unknown property attribute before ',' token
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: expected ')' before ',' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:1: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
 ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: unknown property attribute before ',' token
 @property (atomic, assign) QTMovieModernizerStatus          status                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: expected ')' before ',' token
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual double CvCaptureCAM::getProperty(int)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:9: warning: declaration of 'width' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:25: warning: declaration of 'height' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
                     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual bool CvVideoWriter_QT::writeFrame(const IplImage*)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:1016:20: warning: declaration of 'imagedata' shadows a member of 'this' [-Wshadow]
 unsigned char* imagedata = (unsigned char*)argbimage->imageData;
                ^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library ../../lib/libopencv_video.dylib
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/opencv_video.dir/link.txt --verbose=1
/opt/local/bin/c++  -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -dynamiclib -Wl,-headerpad_max_install_names   -compatibility_version 2.4.0 -current_version 2.4.8 -o ../../lib/libopencv_video.2.4.8.dylib -install_name /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/lib/libopencv_video.2.4.dylib CMakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gaussmix2.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gmg.cpp.o CMakeFiles/opencv_video.dir/src/camshift.cpp.o CMakeFiles/opencv_video.dir/src/kalman.cpp.o CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o CMakeFiles/opencv_video.dir/src/motempl.cpp.o CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o CMakeFiles/opencv_video.dir/src/simpleflow.cpp.o CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o CMakeFiles/opencv_video.dir/src/video_init.cpp.o ../../lib/libopencv_core.2.4.8.dylib ../../lib/libopencv_imgproc.2.4.8.dylib ../../lib/libopencv_core.2.4.8.dylib 
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_symlink_library ../../lib/libopencv_video.2.4.8.dylib ../../lib/libopencv_video.2.4.dylib ../../lib/libopencv_video.dylib
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles  88
[ 42%] Built target opencv_video
make: *** [all] Error 2

Installing OpenCV in Mac Os X (10.9.1)(10.9.1) - video library error

Dear all,

I recently upgraded my gcc compiler to version (4.8.2). After trying to install OpenCV (2.4.8), I get some compiler errors when building the opencv_video library. The way I'm building the OpenCV library is as follows:

cd opencv-2.4.8
mkdir release
cd release/
cmake -D CMAKE_CXX_FLAGS="-I/opt/local/includes -L/opt/local/lib" -D CMAKE_INSTALL_PREFIX="/opt/local" -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE=ON ..
make -j 4

The error message is given below and any feedback/suggestions are really welcomed :-) When following the same steps mentioned above for building the OpenCV library, but with using gcc 4.2.1, I didn't get any compilation problems and the library could be successfully installed.

"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles 
[ 42%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/video_init.cpp.o
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && /opt/local/bin/c++   -DCVAPI_EXPORTS -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -fPIC -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/perf -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/features2d/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/imgproc/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/flann/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/core/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/ts/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/test -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release -I/opt/local/include     -include "/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video/precomp.hpp" -Winvalid-pch  -o CMakeFiles/opencv_video.dir/src/video_init.cpp.o -c /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src/video_init.cpp
In file included from /System/Library/Frameworks/QTKit.framework/Headers/QTKit.h:51:0,
             from /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:46:
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ')' before '(' token
- (void)modernizeWithCompletionHandler:(void (^)(void))handler AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
                                          ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected identifier before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ';' before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: unknown property attribute before ',' token
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: expected ')' before ',' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:1: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
 ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: unknown property attribute before ',' token
 @property (atomic, assign) QTMovieModernizerStatus          status                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: expected ')' before ',' token
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual double CvCaptureCAM::getProperty(int)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:9: warning: declaration of 'width' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:25: warning: declaration of 'height' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
                     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual bool CvVideoWriter_QT::writeFrame(const IplImage*)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:1016:20: warning: declaration of 'imagedata' shadows a member of 'this' [-Wshadow]
 unsigned char* imagedata = (unsigned char*)argbimage->imageData;
                ^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library ../../lib/libopencv_video.dylib
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/opencv_video.dir/link.txt --verbose=1
/opt/local/bin/c++  -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -dynamiclib -Wl,-headerpad_max_install_names   -compatibility_version 2.4.0 -current_version 2.4.8 -o ../../lib/libopencv_video.2.4.8.dylib -install_name /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/lib/libopencv_video.2.4.dylib CMakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gaussmix2.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gmg.cpp.o CMakeFiles/opencv_video.dir/src/camshift.cpp.o CMakeFiles/opencv_video.dir/src/kalman.cpp.o CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o CMakeFiles/opencv_video.dir/src/motempl.cpp.o CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o CMakeFiles/opencv_video.dir/src/simpleflow.cpp.o CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o CMakeFiles/opencv_video.dir/src/video_init.cpp.o ../../lib/libopencv_core.2.4.8.dylib ../../lib/libopencv_imgproc.2.4.8.dylib ../../lib/libopencv_core.2.4.8.dylib 
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_symlink_library ../../lib/libopencv_video.2.4.8.dylib ../../lib/libopencv_video.2.4.dylib ../../lib/libopencv_video.dylib
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles  88
[ 42%] Built target opencv_video
make: *** [all] Error 2

Installing Building OpenCV in Mac Os X (10.9.1) - video library error

Dear all,

I recently upgraded my gcc compiler to version (4.8.2). After trying to install OpenCV (2.4.8), I get some compiler errors when building the opencv_video library. The way I'm building the OpenCV library is as follows:

cd opencv-2.4.8
mkdir release
cd release/
cmake -D CMAKE_CXX_FLAGS="-I/opt/local/includes -L/opt/local/lib" -D CMAKE_INSTALL_PREFIX="/opt/local" -D CMAKE_BUILD_TYPE=Release -D CMAKE_VERBOSE_MAKEFILE=ON ..
make -j 4

The error message is given below and any feedback/suggestions are really welcomed :-) When following the same steps mentioned above for building the OpenCV library, but with using gcc 4.2.1, I didn't get any compilation problems and the library could be successfully installed.

"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles 
[ 42%] Building CXX object modules/video/CMakeFiles/opencv_video.dir/src/video_init.cpp.o
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && /opt/local/bin/c++   -DCVAPI_EXPORTS -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -fPIC -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/perf -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/features2d/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/imgproc/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/flann/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/core/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/ts/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/include -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/test -I/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release -I/opt/local/include     -include "/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video/precomp.hpp" -Winvalid-pch  -o CMakeFiles/opencv_video.dir/src/video_init.cpp.o -c /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/video/src/video_init.cpp
In file included from /System/Library/Frameworks/QTKit.framework/Headers/QTKit.h:51:0,
             from /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:46:
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ')' before '(' token
- (void)modernizeWithCompletionHandler:(void (^)(void))handler AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
                                          ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected identifier before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ';' before '(' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: unknown property attribute before ',' token
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:18: error: expected ')' before ',' token
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:156:1: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
 @property (atomic, readonly) NSError *                      error                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
 ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: unknown property attribute before ',' token
 @property (atomic, assign) QTMovieModernizerStatus          status                   AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
              ^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:162:18: error: expected ')' before ',' token
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual double CvCaptureCAM::getProperty(int)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:9: warning: declaration of 'width' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:453:25: warning: declaration of 'height' shadows a member of 'this' [-Wshadow]
 int width=s1.width, height=s1.height;
                     ^
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm: In member function 'virtual bool CvVideoWriter_QT::writeFrame(const IplImage*)':
/Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/modules/highgui/src/cap_qtkit.mm:1016:20: warning: declaration of 'imagedata' shadows a member of 'this' [-Wshadow]
 unsigned char* imagedata = (unsigned char*)argbimage->imageData;
                ^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library ../../lib/libopencv_video.dylib
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_link_script CMakeFiles/opencv_video.dir/link.txt --verbose=1
/opt/local/bin/c++  -I/opt/local/includes -L/opt/local/lib   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -msse -msse2 -msse3 -O3 -DNDEBUG  -DNDEBUG -dynamiclib -Wl,-headerpad_max_install_names   -compatibility_version 2.4.0 -current_version 2.4.8 -o ../../lib/libopencv_video.2.4.8.dylib -install_name /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/lib/libopencv_video.2.4.dylib CMakeFiles/opencv_video.dir/src/bgfg_gaussmix.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gaussmix2.cpp.o CMakeFiles/opencv_video.dir/src/bgfg_gmg.cpp.o CMakeFiles/opencv_video.dir/src/camshift.cpp.o CMakeFiles/opencv_video.dir/src/kalman.cpp.o CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o CMakeFiles/opencv_video.dir/src/motempl.cpp.o CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o CMakeFiles/opencv_video.dir/src/simpleflow.cpp.o CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o CMakeFiles/opencv_video.dir/src/video_init.cpp.o ../../lib/libopencv_core.2.4.8.dylib ../../lib/libopencv_imgproc.2.4.8.dylib ../../lib/libopencv_core.2.4.8.dylib 
cd /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/modules/video && "/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_symlink_library ../../lib/libopencv_video.2.4.8.dylib ../../lib/libopencv_video.2.4.dylib ../../lib/libopencv_video.dylib
"/Applications/CMake 2.8-12.app/Contents/bin/cmake" -E cmake_progress_report /Users/r2d2/Downloads/sw/opencv/opencv-2.4.8/release/CMakeFiles  88
[ 42%] Built target opencv_video
make: *** [all] Error 2