我在Ubuntu Linux 14.04下运行gcc 4.8.4。我尝试编译从official download page下载的OpenCV 3.0.0。
在解压缩文件上的以下处理链之后:
cd opencv-3.0.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DWITH_QT=OFF -DWITH_OPENGL=ON -DWITH_VTK=OFF -DWITH_TBB=OFF -DWITH_GDAL=OFF -DWITH_XINE=OFF -DBUILD_EXAMPLES=OFF -DBUILT_TESTS=OFF -DBUILD_opencv_world=ON ..
make -j4
我收到以下错误:
Linking CXX executable ../../bin/opencv_test_stitching
[ 94%] Built target opencv_test_stitching
[ 94%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir /__/video/test/ocl/test_optflow_tvl1flow.cpp.o
[ 94%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir/__/video/test/test_accum.cpp.o
[ 94%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir/__/video/test/test_main.cpp.o
[ 94%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir/__/video/test/test_kalman.cpp.o
[ 94%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir/__/video/test/test_camshift.cpp.o
[ 95%] Building CXX object modules/world/CMakeFiles/opencv_test_video.dir/__/video/test/test_tvl1optflow.cpp.o
Linking CXX executable ../../bin/opencv_test_video
[ 95%] Built target opencv_test_video
make: *** [all] Error 2
在make clean上使用VERBOSE = 0;
[ 95%] Building CXX object modules/world/CMakeFiles/opencv_test_imgproc.dir/__/imgproc/test/test_approxpoly.cpp.o
cd /home/hackenberg/opencv/opencv-3.0.0/build/modules/world && /home/hackenberg/bin/c++ -DHAVE_WEBP -DHIGHGUI_EXPORTS -DIMGCODECS_EXPORTS -DVIDEOIO_EXPORTS -D__OPENCV_BUILD=1 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated-declarations -Wno-deprecated-declarations -Wno-deprecated-declarations -O3 -DNDEBUG -DNDEBUG -I/home/hackenberg/opencv/opencv-3.0.0/3rdparty/include/opencl/1.2 -I/home/hackenberg/opencv/opencv-3.0.0/3rdparty/libjasper -I/home/hackenberg/opencv/opencv-3.0.0/3rdparty/libwebp -I/home/hackenberg/opencv/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx/include -I/home/hackenberg/opencv/opencv-3.0.0/build -isystem /usr/include/eigen3 -I/home/hackenberg/opencv/opencv-3.0.0/modules/ts/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/imgproc/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/imgcodecs/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/videoio/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/hal/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/core/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/highgui/include -I/home/hackenberg/opencv/opencv-3.0.0/modules/imgproc/test -isystem /usr/include/x86_64-linux-gnu -isystem /home/hackenberg/opencv/opencv-3.0.0/3rdparty/openexr/Half -isystem /home/hackenberg/opencv/opencv-3.0.0/3rdparty/openexr/Iex -isystem /home/hackenberg/opencv/opencv-3.0.0/3rdparty/openexr/IlmThread -isystem /home/hackenberg/opencv/opencv-3.0.0/3rdparty/openexr/Imath -isystem /home/hackenberg/opencv/opencv-3.0.0/3rdparty/openexr/IlmImf -o CMakeFiles/opencv_test_imgproc.dir/__/imgproc/test/test_approxpoly.cpp.o -c /home/hackenberg/opencv/opencv-3.0.0/modules/imgproc/test/test_approxpoly.cpp
Linking CXX executable ../../bin/opencv_test_imgproc
cd /home/hackenberg/opencv/opencv-3.0.0/build/modules/world && /usr/bin/cmake -E cmake_link_script CMakeFiles/opencv_test_imgproc.dir/link.txt --verbose=0
make[2]: Leaving directory `/home/hackenberg/opencv/opencv-3.0.0/build'
/usr/bin/cmake -E cmake_progress_report /home/hackenberg/opencv/opencv-3.0.0/build/CMakeFiles 35 36 37 38
[ 95%] Built target opencv_test_imgproc
make[1]: Leaving directory `/home/hackenberg/opencv/opencv-3.0.0/build'
make: *** [all] Error 2
似乎找到了解决方案here。
我安装了
sudo apt-get install libgstreamer-plugins-base1.0-dev