Arch LinuxでOpenCVをビルドすると、gccが見つかりません。

Arch LinuxでOpenCVをビルドすると、gccが見つかりません。

以下を使用してOpenCVを正常に構築しました。このLinuxインストールチュートリアル以前は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/gccgccシステムパスにあることを再確認するために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

ベストアンサー1

cmake以前に設定されたすべての変数を上書きするとし、Ubuntuコンピュータからopencvディレクトリをコピーしました。ところで、CMakeCache.txtを上書きせず、パスが誤って認識されるようです。

簡単な修正:

  1. 以下からきれいなopencvディストリビューションをダウンロードしてください。http://opencv.org/
  2. 前のようにチュートリアルに従ってください。

おすすめ記事