在 Arch Linux 上建構 OpenCV 找不到 gcc
過去,我曾在 Ubuntu 發行版上使用此 linux 安裝教程成功建構 OpenCV ,但最近,我需要在 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
使用了錯誤的路徑?我該如何解決這個錯誤?ps 完整的 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
我從我的 Ubuntu 機器上複製了 opencv 目錄,並假設它
cmake
會覆蓋任何以前設置的變數。但是,我相信 CMakeCache.txt 沒有被覆蓋,導致路徑辨識錯誤。輕鬆修復:
- 從http://opencv.org/下載乾淨的 opencv 發行版
- 像以前一樣遵循教程。
首先,您的系統不是最新的。更新它
pacman -Syu
。你說你的 gcc 是 5.2.0 版。目前版本是 6.3.1。所以不知何故 CMake 想要使用/usr/bin/gcc-5
which 不存在而不是/usr/bin/gcc
.其次,有ABS。您可以確保您當地的 ABS 樹是最新的。然後復製
/var/abs/extra/opencv
到某個目錄並執行makepkg
.第三,即使你出於某種原因不想使用 ABS,也不應該
/usr/local
在 Arch Linux 中使用。請參閱https://wiki.archlinux.org/index.php/Arch_packaging_standards#Directories。你應該/usr
改用。