본문 바로가기
개발 이야기/머신러닝, 딥러닝

[문제해결] OpenCV 4.5.3 리눅스 빌드 중 cmake 오류_No source or binary directory provided. Both will be assumed to be the same as the current working directory,but note that this warning will become a fatal error in future CMake releases.

by AI 동키 2021. 8. 10.
반응형

 

문제

Linux 환경에 OpenCV 설치 중, 다운로드, 관련 패키지 설치 등을 끝마치고 

cmake 빌드 시 오류 발생

타 블로그와 같이 아래와 같이 입력했으나, 

오류 발생

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv-sources/opencv453/opencv_contrib-4.5.3/modules \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_DOCS=OFF \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_CUDA=ON \
-D WITH_CUBLAS=ON \
-D WITH_CUDNN=ON \
-D CUDA_FAST_MATH=1 \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 \
-D OPENCV_DNN_CUDA=ON \
-D CUDA_ARCH_BIN=8.6 \
-D CUDA_ARCH_PTX=8.6 \
-D CUDNN_VERSION=8.2 \
-D CUDNN_INCLUDE_DIR=/usr/local/cuda-11.4/include \
-D CUDNN_LIBRARY=/usr/local/cuda-11.4/lib64/libcudnn.so.8.2.2 \
-D WITH_VTK=ON \
-D WITH_OPENCL=ON \
-D OPENCV_SKIP_PYTHON_LOADER=ON \
-D PYTHON_EXECUTABLE=~/anaconda3/bin/python3 \
-D PYTHON3_INCLUDE_DIR=~/anaconda3/include/python3.8 \
-D PYTHON3_NUMPY_INCLUDE_DIRS=~/anaconda3/lib/python3.8/site-packages/numpy/core/include \
-D PYTHON3_PACKAGES_PATH=~/anaconda3/lib/python3.8/site-packages \
-D PYTHON3_LIBRARY=~/anaconda3/lib/libpython3.8.so \
-D PYTHON_LIBRARIES=~/anaconda3/lib/python3.8 ..

아래와 같은 오류 발생함.

No source or binary directory provided. 
Both will be assumed to be the same as the current working directory,
but note that this warning will become a fatal error in future CMake releases.

 

해결

의외로 간단히 해결함.

cmake 뒤에 역슬래쉬 하나를 붙여줌.

각 줄 역슬래시 사이 엔터 없애줌.

cmake \ -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv-sources/opencv453/opencv_contrib-4.5.3/modules \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_DOCS=OFF \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_CUDA=ON \
-D WITH_CUBLAS=ON \
-D WITH_CUDNN=ON \
-D CUDA_FAST_MATH=1 \
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.4 \
-D OPENCV_DNN_CUDA=ON \
-D CUDA_ARCH_BIN=8.6 \
-D CUDA_ARCH_PTX=8.6 \
-D CUDNN_VERSION=8.2 \
-D CUDNN_INCLUDE_DIR=/usr/local/cuda-11.4/include \
-D CUDNN_LIBRARY=/usr/local/cuda-11.4/lib64/libcudnn.so.8.2.2 \
-D WITH_VTK=ON \
-D WITH_OPENCL=ON \
-D OPENCV_SKIP_PYTHON_LOADER=ON \
-D PYTHON_EXECUTABLE=~/anaconda3/bin/python3 \
-D PYTHON3_INCLUDE_DIR=~/anaconda3/include/python3.8 \
-D PYTHON3_NUMPY_INCLUDE_DIRS=~/anaconda3/lib/python3.8/site-packages/numpy/core/include \
-D PYTHON3_PACKAGES_PATH=~/anaconda3/lib/python3.8/site-packages \
-D PYTHON3_LIBRARY=~/anaconda3/lib/libpython3.8.so \
-D PYTHON_LIBRARIES=~/anaconda3/lib/python3.8 ..

 

 

그 외

다른 OpenCV 설치 글들을 참고하여 변수들을 나의 환경에 맞게 잘 맞춰 주어야 한다.

CUDA_ARCH_BIN

CUDA_ARCH_PTX  

변수는 아래에서 GPU 모델을 살펴보고 입력하면 된다.

https://developer.nvidia.com/cuda-gpus

 

CUDA GPUs

Your GPU Compute Capability Are you looking for the compute capability for your GPU, then check the tables below. NVIDIA GPUs power millions of desktops, notebooks, workstations and supercomputers around the world, accelerating computationally-intensive ta

developer.nvidia.com

감사합니다.

 

 

반응형

댓글