Reputation: 71
I'm trying to build a docker image with the latest opencv version 4.1.0 to be able to use cudafeatures2D. I have cuda 9.0 installed but every time i try to compile opencv from source it says it doesn't find CUDA.
I'm using the build runtime image FROM nvidia/cuda:9.0-cudnn7-runtime. And i've checked in my current image the location of CUDA, /usr/local/cuda-9.0
.
This is the code I'm using to install:
ENV PATH=$PATH:/usr/local/cuda/bin:$PATH
ENV LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH
RUN ldconfig
RUN wget https://github.com/opencv/opencv/archive/4.1.0.tar.gz && tar xf 4.1.0.tar.gz && rm 4.1.0.tar.gz
RUN wget https://github.com/opencv/opencv_contrib/archive/4.1.0.tar.gz && tar xf 4.1.0.tar.gz && rm 4.1.0.tar.gz
RUN cd opencv-4.1.0/ && mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D WITH_CUBLAS=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_OPENGL=ON -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -D PYTHON2_EXECUTABLE=/usr/bin/python2.7 -D PYTHON_INCLUDE_DIR=/usr/include/python2.7/ -D PYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python2.7/ -D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so -D PYTHON2_NUMPY_INCLUDE_DIRS=/usr/local/lib/python2.7/dist-packages/numpy/core/include/ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules/ -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0 -D CUDA_CUDART_LIBRARY=/usr/local/cuda/lib64/libcudart.so -D CUDA_VERBOSE_BUILD=ON .. && make -j$(nproc) && make install
But I always get this error:
-- at: /app/opencv-3.4.6/build/3rdparty/ippicv/ippicv_lnx/iw
CMake Warning at cmake/OpenCVFindLibsPerf.cmake:35 (message):
OpenCV is not able to find/configure CUDA SDK (required by WITH_CUDA).
CUDA support will be disabled in OpenCV build.
To eliminate this warning remove WITH_CUDA=ON CMake configuration option.
Call Stack (most recent call first):
CMakeLists.txt:794 (include)
Upvotes: 3
Views: 1863
Reputation: 71
finally someone from the opencv repository pointed out that the problem I was having was due to the image I was using:
FROM nvidia/cuda:9.0-cudnn7-runtime
The runtime version usually doesn't contain the SDK files, the fix was to change -runtime for -develop.
Upvotes: 3