CMake Error: Variables are set to NOTFOUND

后端 未结 10 1516
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 05:22

I installed cuda first using cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb. Now I\'m trying to install OpenCV 3.3.0 But i\'m getting CMake Err

相关标签:
10条回答
  • 2020-11-28 06:14

    I also had to do the following in OpenCVDetectCUDA.cmake:

    replace

        if(${CUDA_VERSION} VERSION_LESS "8.0")
           set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2")
         else()
           set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1")
         endif()
    

    with

        if(${CUDA_VERSION} VERSION_LESS "8.0")
          set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2")    
          set(CUDA_ARCH_BIN "3.0 3.5 3.7 5.0 5.2")
        else()
          set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1")
          set(CUDA_ARCH_BIN "3.0 3.5 3.7 5.0 5.2 6.0 6.1")
        endif()
    
    0 讨论(0)
  • 2020-11-28 06:16

    I met the same problem here when installing opencv4.2 with cuda.

    My cmake version is 3.16.2 at first. However, this version doesn't support HTTP download so that you might meet the download fail problem.

    So I re-installed my cmake to version 3.9, which support HTTP protocal and the download problem was solved.

    But the new problem was the same as @ja_cpp mentioned above. (CUDA_nppi_LIBRARY (ADVANCED) not found when cmake)

    I followed @api55's method and modified FindCUDA.cmake and OpenCVDetectCUDA.cmake, but the problem was still there.

    And because I was installing opencv4.2 not opecv3 so I think that's why the modification didn't work.

    The most tricky thing is, I updated back my cmake version to 3.16.2, and cmake again with non-modified files again, and it worked!

    I used this command.

    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE=ON -D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D CUDA_ARCH_BIN=6.1 -D WITH_CUBLAS=1 -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D HAVE_opencv_python3=ON -D PYTHON_EXECUTABLE=~/pengwenchen/anaconda3/envs/pytorch/bin/python -D BUILD_EXAMPLES=ON ..
    

    My environment: GPU-1080, cmake version 3.16.2, cuda version 10.0

    Hope this answer could help those who are installing opencv4.2 with cuda. :)

    0 讨论(0)
  • 2020-11-28 06:24

    Replace the exisiting opencv with the latest version, it works fine. XD

    0 讨论(0)
  • 2020-11-28 06:25

    I had the same error installing with the next setup.

    Ubuntu 18.04 cuda, cudnn, opencv 4.2 and 4.3. Have made several attempts to fix this and finally come out with the next working installation.

    Important that no drivers have been installed yet. Have noticed that my installation only works from a clean installation of ubuntu

    change the GPU_ARCH version for your situation. Check https://developer.nvidia.com/cuda-gpus for your version

    export CUDA_VERSION='10.2.89'
    export CUDA_PKG_VERSION='10-2=10.2.89-1'
    export PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
    export LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
    export NCCL_VERSION='2.5.6'
    export CUDNN_VERSION='7.6.5.32'
    export OPENCV_VERSION='4.3.0'
    export GPU_ARCH='6.1'
    
    apt-get update  && \
    apt-get install -y --no-install-recommends \
    gnupg2 curl ca-certificates && \
        curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add - && \
        echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \
        echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
    
    
    apt-get update && \
    apt-get install -y --no-install-recommends \
            cuda-cudart-$CUDA_PKG_VERSION \
    cuda-compat-10-2 && \
    ln -s cuda-10.2 /usr/local/cuda
    
    
    apt-get update && \
    apt-get install -y --no-install-recommends \
        cuda-libraries-$CUDA_PKG_VERSION \
    cuda-nvtx-$CUDA_PKG_VERSION \
    libcublas10=10.2.2.89-1 \
    libnccl2=$NCCL_VERSION-1+cuda10.2 && \
        apt-mark hold libnccl2 
    
    
    apt-get update && apt-get install -y --no-install-recommends \
        libcudnn7=$CUDNN_VERSION-1+cuda10.2 && \
        apt-mark hold libcudnn7
    
    
    apt-get update && apt-get install -y --no-install-recommends \
            cuda-nvml-dev-$CUDA_PKG_VERSION \
            cuda-command-line-tools-$CUDA_PKG_VERSION \
    cuda-libraries-dev-$CUDA_PKG_VERSION \
            cuda-minimal-build-$CUDA_PKG_VERSION \
            libnccl-dev=$NCCL_VERSION-1+cuda10.2 \
    libcublas-dev=10.2.2.89-1
    
    
    apt-get update && apt-get install -y --no-install-recommends \
        libcudnn7=$CUDNN_VERSION-1+cuda10.2 \
    libcudnn7-dev=$CUDNN_VERSION-1+cuda10.2 && \
        apt-mark hold libcudnn7
    
    
    
    apt update && \
        apt install -y \
        tzdata \
        git \
        cmake \
        wget \
        unzip \
        build-essential \
        zlib1g-dev \
        libjpeg-dev \
        libwebp-dev \
        libpng-dev \
        libtiff5-dev \
        libopenexr-dev \
        libgdal-dev \
        libgtk2.0-dev \
        libdc1394-22-dev \
        libavcodec-dev \
        libavformat-dev \
        libswscale-dev \
        libtheora-dev \
        libvorbis-dev \
        libxvidcore-dev \
        libx264-dev \
        yasm \
        libopencore-amrnb-dev \
        libopencore-amrwb-dev \
        libv4l-dev \
        libxine2-dev \
        libgstreamer1.0-dev \
        libgstreamer-plugins-base1.0-dev \
        libtbb-dev \
        libeigen3-dev \
        python3-dev \
        python3-tk \
        python3-numpy
    
    
    
    wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
        unzip ${OPENCV_VERSION}.zip && rm ${OPENCV_VERSION}.zip && \
        mv opencv-${OPENCV_VERSION} OpenCV && \
        cd OpenCV && \
        wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip && \
        unzip ${OPENCV_VERSION}.zip && \
        mkdir build && \
        cd build && \
        cmake \
          -D WITH_TBB=ON \
          -D CMAKE_BUILD_TYPE=RELEASE \
          -D BUILD_EXAMPLES=ON \
          -D WITH_FFMPEG=ON \
          -D WITH_V4L=ON \
          -D WITH_OPENGL=ON \
          -D WITH_CUDA=ON \
          -D WITH_GSTREAMER=ON \
          -D OPENCV_DNN_CUDA=ON \
          -D CUDA_ARCH_BIN=${GPU_ARCH} \
          -D CUDA_ARCH_PTX=${GPU_ARCH} \
          -D WITH_CUBLAS=ON \
          -D WITH_CUFFT=ON \
          -D WITH_EIGEN=ON \
          -D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
          -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-${OPENCV_VERSION}/modules/ \
          ..
    
    make all -j$(nproc)
    make
    
    0 讨论(0)
提交回复
热议问题