만약 cmake로 빌드시 아래와 같은 에러메시지가 날 경우opencv의 라이브러리 경로를 찾지 못하여 발생하는 문제이다.
yocto:~/opencv/examples/face_detect$ cmake CMakeLists.txt -- The C compiler identification is GNU 4.9.3 -- The CXX compiler identification is GNU 4.9.3 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:3 (find_package): By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but CMake did not find one. Could not find a package configuration file provided by "OpenCV" with any of the following names: OpenCVConfig.cmake opencv-config.cmake Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set "OpenCV_DIR" to a directory containing one of the above files. If "OpenCV" provides a separate development package or SDK, be sure it has been installed. -- Configuring incomplete, errors occurred! See also "/home/root/opencv/examples/face_detect/CMakeFiles/CMakeOutput.log". yocto:~/opencv/examples/face_detect$ |
이러한 경우 CMakeLists.txt를 살펴보면 환경변수에 대해 등록된 값이 없어서 문제가 발생하게 된다. 아래 파란색 글자와 같이 수작업으로 경로를 지정해주면 된다.
cmake_minimum_required(VERSION 2.8) project(AprilTagDetect) SET(OpenCV_DIR /usr/lib64/cmake/opencv4) SET(OpenCV_INCLUDE_DIRS "/usr/lib64;/usr/lib;/usr/include/opencv4;/usr/lib64/cmake/opencv4") SET(OpenCV_LIB_DIR "/usr/lib64") find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) add_executable(TagDetect april-tag-detect.cpp) target_link_libraries(TagDetect ${OpenCV_LIBS}) |
수정후 아래와 같이 정상적으로 빌드가 된다.
yocto:~/opencv/examples/face_detect$ vi CMakeLists.txt yocto:~/opencv/examples/face_detect$ cmake CMakeLists.txt -- Found OpenCV: /usr (found version "4.5.2") -- Configuring done -- Generating done -- Build files have been written to: /home/root/opencv/examples/face_detect |
728x90
'엔지니어링 > 임베디드' 카테고리의 다른 글
catkin 빌드 시스템 (0) | 2021.09.25 |
---|---|
Ubuntu 20.04에 ROS Noetic 설치하기 (0) | 2021.08.16 |
OPKG 사용법 (0) | 2021.05.29 |
우분투 리눅스에서 Could not get lock /var/lib/dpkg/lock-frontend 에러 해결방법 (0) | 2021.03.14 |
Ubuntu 22.04에 NVIDIA 그래픽 드라이버 설치 (0) | 2020.11.28 |
댓글