Reputation: 91
I am trying to build my project using Conan. My project use OpenCV.
I am using Conan version 2.12.2.
I ran the following command :
sudo conan install .. --build=missing -of . -s:h compiler.cppstd=gnu17 -s:b compiler.cppstd=gnu17 -c tools.system.package_manager:mode=install
I use sudo so that conan can install the system libraries that GStreamer depends on, and execute sudo apt-get.
And then :
cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
which failed.
The problem I encounters is the following :
CMake Error at build/cmakedeps_macros.cmake:66 (message):
Library 'opencv_video' not found in package. If 'opencv_video' is a system
library, declare it with 'cpp_info.system_libs' property
OS Info :
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
conanfile.txt:
[requires]
opencv/4.10.0
...
[options]
opencv/*:with_ffmpeg=True
opencv/*:with_gstreamer=True
opencv/*:with_v4l=True
opencv/*:gapi=False
...
[generators]
CMakeDeps
CMakeToolchain
conan profile info :
Host profile:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
Build profile:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
CMakeLists.txt
find_package(OpenCV REQUIRED COMPONENTS core imgproc highgui video) # I test without the COMPONENTS aswell.
...
target_link_libraries(videocapture
PRIVATE
opencv::opencv opencv::opencv_video # I tested with and without opencv::opencv_video aswell as other core components. Didn't change anything.
...
)
Solutions I tried: building from source and linking that from the CMake works on another computer. I modified multiple time the Conanfile.txt to includes different options but nothing worked. I modified the CMakeLists.txt multiple times aswell and nothing worked.
The main goal is to be able to compile my program on arm/amd linux system easily.
EDIT 24/02 16:41 : Added conan/cmake commands, and conan version
EDIT 25/02 : Added cmake output and sudo usage explanation
cmake logs (the actual log file is way too long to be added) :
cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
CMake Warning (dev) at CMakeLists.txt:118:
Syntax Warning in cmake code at column 50
Argument not separated from preceding token by whitespace.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Using Conan toolchain: /home/winston2/video-manager/arm/build/conan_toolchain.cmake
-- Conan toolchain: Defining architecture flag: -m64
-- Conan toolchain: C++ Standard 17 with extensions ON
-- Conan: Component target declared 'opencv_core'
-- Conan: Component target declared 'opencv::opencv_core_alias'
-- Conan: Component target declared 'opencv_flann'
-- Conan: Component target declared 'opencv_imgproc'
-- Conan: Component target declared 'opencv_ml'
-- Conan: Component target declared 'opencv_dnn'
-- Conan: Component target declared 'opencv_features2d'
-- Conan: Component target declared 'opencv::opencv_flann_alias'
-- Conan: Component target declared 'opencv_imgcodecs'
-- Conan: Component target declared 'opencv::opencv_imgproc_alias'
-- Conan: Component target declared 'opencv::opencv_ml_alias'
-- Conan: Component target declared 'opencv_photo'
-- Conan: Component target declared 'opencv_calib3d'
-- Conan: Component target declared 'opencv::opencv_dnn_alias'
-- Conan: Component target declared 'opencv::opencv_features2d_alias'
-- Conan: Component target declared 'opencv::opencv_imgcodecs_alias'
-- Conan: Component target declared 'opencv::opencv_photo_alias'
-- Conan: Component target declared 'opencv_videoio'
-- Conan: Component target declared 'opencv::opencv_calib3d_alias'
-- Conan: Component target declared 'opencv_highgui'
-- Conan: Component target declared 'opencv_objdetect'
-- Conan: Component target declared 'opencv_stitching'
-- Conan: Component target declared 'opencv_video'
-- Conan: Component target declared 'opencv::opencv_videoio_alias'
-- Conan: Component target declared 'opencv::opencv_highgui_alias'
-- Conan: Component target declared 'opencv::opencv_objdetect_alias'
-- Conan: Component target declared 'opencv::opencv_stitching_alias'
-- Conan: Component target declared 'opencv::opencv_video_alias'
-- Conan: Target declared 'opencv::opencv'
CMake Error at build/cmakedeps_macros.cmake:66 (message):
Library 'opencv_video' not found in package. If 'opencv_video' is a system
library, declare it with 'cpp_info.system_libs' property
Call Stack (most recent call first):
build/OpenCV-Target-release.cmake:23 (conan_package_library_targets)
build/OpenCVTargets.cmake:24 (include)
build/OpenCVConfig.cmake:16 (include)
CMakeLists.txt:17 (find_package)
-- Configuring incomplete, errors occurred!
Upvotes: 1
Views: 33