다음을 사용하여 OpenCV를 성공적으로 구축했습니다.이 리눅스 설치 튜토리얼예전에는 Ubuntu 배포판에서 빌드했는데, 최근에는 Arch Linux 배포판에서 빌드해야 했습니다.
이 명령은
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. -Wno-dev
다음 줄을 포함하여 오류가 없는 것으로 보이는 로그를 생성합니다.
Detected version of GNU GCC: 52 (502)
... <skipped lines> ...
C Compiler: /usr/bin/cc
하지만 명령을 실행하면 make
다음 오류가 발생합니다.
/usr/bin/gcc-5: No such file or directory
CMake Error at cuda_compile_generated_gpu_mat.cu.o.cmake:208 (message): Error generating /home/cecilia/opencv-3.0.0/build/modules/core/CMakeFiles/cuda_compile.dir
/src/cuda/./cuda_compile_generated_gpu_mat.cu.o
이것은 분명히 잘못된 길입니다. gcc
예 usr/bin/gcc
. gcc
시스템 경로에 있는지 다시 확인하기 위해 gcc -v
프로덕션을 실행했습니다.
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5.2.0/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.2.0 (GCC)
로그의 버전 번호와 일치합니다 cmake
.
cmake
올바른 gcc 버전이 감지되었지만 make
잘못된 경로가 사용된 이유는 무엇입니까 ? 이 오류를 어떻게 해결할 수 있나요?
p.s. 제가 놓친 부분이 있을 경우를 대비해 전체 cmake 로그가 아래에 있습니다.
-- Detected version of GNU GCC: 52 (502)
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Found OpenEXR: /lib64/libIlmImf.so
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- found IPP (ICV version): 8.2.1 [8.2.1]
-- at: /home/cecilia/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx
-- CUDA detected: 7.5
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_30,code=compute_30
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "3.4" (found /usr/bin/python3.4)
-- Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "3.2" (found )
-- Found apache ant 1.9.6: /bin/ant
-- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
-- Found VTK ver. 6.3.0 (usefile: /usr/lib/cmake/vtk-6.3/UseVTK.cmake)
-- Assume that non-module dependency is available: /usr/lib/x86_64-linux-gnu/libz.so (for module opencv_core)
-- Assume that non-module dependency is available: /usr/lib64/libgl2ps.so (for module opencv_viz)
-- videoio: Removing WinRT API headers by default
--
-- General configuration for OpenCV 3.0.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Host: Linux 4.2.5-1-ARCH x86_64
-- CMake: 3.3.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
--
-- C/C++:
-- Built as dynamic libs?: YES
-- C++ Compiler: /usr/bin/c++ (ver 5.2.0)
-- C++ flags (Release): -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 -O3 -DNDEBUG -DNDEBUG
-- C++ flags (Debug): -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 -g -O0 -DDEBUG -D_DEBUG
-- C Compiler: /usr/bin/cc
-- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -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 -O3 -DNDEBUG -DNDEBUG
-- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -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 -g -O0 -DDEBUG -D_DEBUG
-- Linker flags (Release):
-- Linker flags (Debug):
-- Precompiled headers: YES
-- Extra dependencies: /lib64/libwebp.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /lib64/libtiff.so /lib64/libjasper.so /lib64/libjpeg.so /lib64/libImath.so /lib64/libIlmImf.so /lib64/libIex.so /lib64/libHalf.so /lib64/libIlmThread.so gtk-3 gdk-3 pangocairo-1.0 pango-1.0 atk-1.0 cairo-gobject cairo gdk_pixbuf-2.0 gio-2.0 gthread-2.0 gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 dc1394 v4l1 v4l2 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg avresample gphoto2 gphoto2_port exif /lib64/libbz2.so /usr/lib64/libfreetype.so /usr/lib64/libgl2ps.so /usr/lib64/libjpeg.so /usr/lib64/libpng.so /usr/lib64/libtiff.so /usr/lib64/libz.so vtkCommonColor vtkCommonComputationalGeometry vtkCommonCore vtkCommonDataModel vtkCommonExecutionModel vtkCommonMath vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkDICOMParser vtkFiltersCore vtkFiltersExtraction vtkFiltersGeneral vtkFiltersGeometry vtkFiltersModeling vtkFiltersSources vtkFiltersStatistics vtkFiltersTexture vtkIOCore vtkIOExport vtkIOGeometry vtkIOImage vtkIOPLY vtkImagingColor vtkImagingCore vtkImagingFourier vtkImagingHybrid vtkInteractionStyle vtkRenderingAnnotation vtkRenderingContext2D vtkRenderingContextOpenGL vtkRenderingCore vtkRenderingFreeType vtkRenderingGL2PS vtkRenderingLOD vtkRenderingLabel vtkRenderingOpenGL vtkalglib vtkftgl vtkmetaio vtksys dl m pthread rt cudart nppc nppi npps cufft
-- 3rdparty dependencies: ippicv
--
-- OpenCV modules:
-- To be built: hal cudev core cudaarithm flann imgproc ml video viz cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo java stitching superres videostab
-- Disabled: world
-- Disabled by dependency: -
-- Unavailable: python2 python3
--
-- GUI:
-- QT: NO
-- GTK+ 3.x: YES (ver 3.18.2)
-- GThread : YES (ver 2.46.1)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: YES (ver 6.3.0)
--
-- Media I/O:
-- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
-- JPEG: /lib64/libjpeg.so (ver )
-- WEBP: /lib64/libwebp.so (ver encoder: 0x0202)
-- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver ..)
-- TIFF: /lib64/libtiff.so (ver 42 - 4.0.6)
-- JPEG 2000: /lib64/libjasper.so (ver 1.900.1)
-- OpenEXR: /lib64/libImath.so /lib64/libIlmImf.so /lib64/libIex.so /lib64/libHalf.so /lib64/libIlmThread.so (ver 2.2.0)
-- GDAL: NO
--
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.3)
-- FFMPEG: YES
-- codec: YES (ver 56.41.100)
-- format: YES (ver 56.36.100)
-- util: YES (ver 54.27.100)
-- swscale: YES (ver 3.1.101)
-- resample: YES (ver 2.1.0)
-- gentoo-style: YES
-- GStreamer:
-- base: YES (ver 1.6.1)
-- video: YES (ver 1.6.1)
-- app: YES (ver 1.6.1)
-- riff: YES (ver 1.6.1)
-- pbutils: YES (ver 1.6.1)
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- OpenNI2: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- UniCap: NO
-- UniCap ucil: NO
-- V4L/V4L2: Using libv4l1 (ver 1.6.3) / libv4l2 (ver 1.6.3)
-- XIMEA: NO
-- Xine: NO
-- gPhoto2: YES
--
-- Other third-party libraries:
-- Use IPP: 8.2.1 [8.2.1]
-- at: /home/cecilia/opencv-3.0.0/3rdparty/ippicv/unpack/ippicv_lnx
-- Use IPP Async: NO
-- Use Eigen: NO
-- Use TBB: NO
-- Use OpenMP: NO
-- Use GCD NO
-- Use Concurrency NO
-- Use C=: NO
-- Use pthreads for parallel for:
-- YES
-- Use Cuda: YES (ver 7.5)
-- Use OpenCL: YES
--
-- NVIDIA CUDA
-- Use CUFFT: YES
-- Use CUBLAS: NO
-- USE NVCUVID: NO
-- NVIDIA GPU arch: 20 21 30 35
-- NVIDIA PTX archs: 30
-- Use fast math: NO
--
-- OpenCL:
-- Version: dynamic
-- Include path: /home/cecilia/opencv-3.0.0/3rdparty/include/opencl/1.2
-- Use AMDFFT: NO
-- Use AMDBLAS: NO
--
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.10)
--
-- Python 3:
-- Interpreter: NO
--
-- Python (for build): /usr/bin/python2.7
--
-- Java:
-- ant: /bin/ant (ver 1.9.6)
-- JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include/linux /usr/lib/jvm/default-java/include
-- Java wrappers: YES
-- Java tests: YES
--
-- Matlab:
-- mex: NO
--
-- Documentation:
-- Doxygen: /usr/bin/doxygen (ver 1.8.10)
-- PlantUML: NO
--
-- Tests and samples:
-- Tests: YES
-- Performance tests: YES
-- C/C++ Examples: NO
--
-- Install path: /usr/local
--
-- cvconfig.h is in: /home/cecilia/opencv-3.0.0/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cecilia/opencv-3.0.0/build
답변1
cmake
이전에 설정된 모든 변수를 덮어쓴다고 가정하고 Ubuntu 컴퓨터에서 opencv 디렉터리를 복사했습니다 . 그런데 CMakeCache.txt를 덮어쓰지 않아서 경로가 잘못 인식되는 것 같아요.
쉬운 수정:
- 다음에서 깨끗한 opencv 배포판을 다운로드하세요.http://opencv.org/
- 이전과 같이 튜토리얼을 따르세요.
답변2
첫째, 시스템이 최신 상태가 아닙니다. pacman -Syu
.gcc 버전이 5.2.0이라고 말씀하셨습니다 . 현재 버전은 6.3.1입니다. 그래서 어떻게든 CMake는 /usr/bin/gcc-5
대신에 통지하는 것을 사용하고 싶어합니다 /usr/bin/gcc
.
둘째,ABS. 로컬 ABS 트리가 최신 상태인지 확인할 수 있습니다. 그런 다음 /var/abs/extra/opencv
디렉터리에 복사 하고 makepkg
.
셋째, 어떤 이유로 ABS를 사용하고 싶지 않더라도 /usr/local
아치 리눅스에서는 사용하면 안 됩니다. 바라보다https://wiki.archlinux.org/index.php/Arch_packaging_standards#Directories. 을 사용해야 합니다 /usr
.