conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.27k stars 981 forks source link

[question] CMAKE cannot find libraries added to cmakelists, except for zlib #16080

Closed davidelahoz closed 7 months ago

davidelahoz commented 7 months ago

What is your question?

I'm using conan for managing libraries in a C++ project. When building the example provided in the documentation (https://docs.conan.io/2/tutorial/consuming_packages/build_simple_cmake_project.html), zlib is found and compilation is succesful. However, cmake fails to fine any other library installed with conan 2.

Is there a way to indicate cmake in which folder those libraries can be found? (for example using add_subdirectory)

As an example, I provide conanfile.txt and CMakeLists.txt used for adding opencv to the project, but other libraries like miniz also fail to be found.

conanfile.txt

[requires]
opencv/4.9.0

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

CMakeLists.txt

cmake_minimum_required(VERSION 3.15...3.26)
project(${SKBUILD_PROJECT_NAME} LANGUAGES C CXX)

find_package(
  Python
  COMPONENTS Interpreter Development.Module
  REQUIRED)

find_package(
  SWIG
  COMPONENTS python
  REQUIRED)

find_package(OPENCV REQUIRED)

include(UseSWIG)

swig_add_library(
  example
  LANGUAGE python OUTPUT_DIR "${SKBUILD_PLATLIB_DIR}"
  SOURCES include/example.i src/example.c)
if(WIN32)
  set_property(TARGET example PROPERTY SUFFIX ".${Python_SOABI}.pyd")
else()
  set_property(TARGET example
               PROPERTY SUFFIX ".${Python_SOABI}${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
target_link_libraries(example PRIVATE Python::Module OPENCV)

install(TARGETS example DESTINATION .)

Makefile used for building the project

setup:
    conan install . --build=missing
build:
    pipx run build

install:
    pip install .

all: setup build install

Output

CMake Error at CMakeLists.txt:14 (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.

Have you read the CONTRIBUTING guide?

memsharded commented 7 months ago

Hi @davidelahoz

Thanks for your question.

I would be missing some data:

It is possible that your spelling of OpenCV is wrong, it should be find_package(OpenCV). That spelling should be in the conan install output.

davidelahoz commented 7 months ago

Thanks for answering so fast. Using find_package(OpenCV REQUIRED) and target_link_libraries(example PRIVATE Python::Module opencv::opencv) results in the same error:

pipx run build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - scikit-build-core
  - swig
* Getting build dependencies for sdist...
* Installing packages in isolated environment:
  - pathspec
  - pyproject_metadata
* Building sdist...
*** scikit-build-core 0.8.2 (sdist)
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - scikit-build-core
  - swig
* Getting build dependencies for wheel...
* Installing packages in isolated environment:
  - ninja>=1.5
  - pathspec
  - pyproject_metadata
* Building wheel...
*** scikit-build-core 0.8.2 using CMake 3.22.1 (wheel)
2024-04-16 07:13:26,379 - scikit_build_core - WARNING - No license files found, set wheel.license-files to [] to suppress this warning
*** Configuring CMake...
loading initial cache file /tmp/tmp4h2_fer5/build/CMakeInit.txt
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python: /tmp/build-env-zc7zmxsg/bin/python (found version "3.10.12") found components: Interpreter Development.Module 
-- Found SWIG: /tmp/build-env-zc7zmxsg/bin/swig4.0 (found version "4.2.1") found components: python 
CMake Error at CMakeLists.txt:14 (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.

I provide below the requested data:

Platform details

Conan install output

conan install . --build=missing

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
[conf]
tools.system.package_manager:mode=install

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
[conf]
tools.system.package_manager:mode=install

======== Computing dependency graph ========
Graph root
    conanfile.txt: /config/workspace/lib/conanfile.txt
Requirements
    ade/0.1.2d#f225d0a218a7c9fbb81746806c7de53d - Cache
    autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache
    automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache
    brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache
    dav1d/1.2.1#94259c8baa2b1e7ab9976f1c20822be8 - Cache
    eigen/3.4.0#2e192482a8acff96fe34766adca2b24c - Cache
    expat/2.6.0#2f92fb3cf504e9731aba6d20dcd641bf - Cache
    ffmpeg/4.4.4#0e4bd98a7a3303ae108adb9940f9ec3f - Cache
    flac/1.4.2#6a17595ab773d2de32e18b5d3b24afff - Cache
    freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498 - Cache
    imath/3.1.9#2e7f5802b247baae47235b4c8d5642c9 - Cache
    jasper/4.2.0#bbda6a34e0a3d3e9caff91c15f632902 - Cache
    jbig/20160605#2d29fa02aacd76902e0d2cbbc24631ef - Cache
    libalsa/1.2.10#8b568d62190ef588cd5dcdd81171c289 - Cache
    libaom-av1/3.6.1#a569b342c6f8129cf327709e18691072 - Cache
    libcap/2.69#7ef2d60864c2e58e89db957be936dc49 - Cache
    libdeflate/1.19#3ea74a4549efc14d4b1202dc4bfbf602 - Cache
    libfdk_aac/2.0.3#a4041d75d31de57214adeb9c6f9cae26 - Cache
    libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache
    libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache
    libjpeg/9e#68269859e4325ddc3f995d1fd3fc9187 - Cache
    libmp3lame/3.100#44b12d19316eb2b223d98d3e75dae438 - Cache
    libpng/1.6.43#c219d8f01983bac10c404fc613605eef - Cache
    libsndfile/1.2.2#b3662f832e29507e8d9840a43737cc14 - Cache
    libtiff/4.6.0#51d0e7e15d032aeec1b64e65c44ecd9f - Cache
    libtool/2.4.7#08316dad5c72c541ed21e039e4cf217b - Cache
    libvpx/1.13.1#31c5cc0bc9fff2b5baf5a1fac60bd9c9 - Cache
    libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38 - Cache
    libx264/cci.20220602#310132b8f365d0d74028128d3677f132 - Cache
    libx265/3.4#60fd8f9d5a93fd2338a46a0664ddc768 - Cache
    libxml2/2.12.3#071b32ddc1353a239d3697319c68beca - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache
    mpg123/1.31.2#ce831c936b2284e2066ab3dc58a2628e - Cache
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef - Cache
    opencv/4.9.0#fadd44c87e06cd62e207b1b7e580b293 - Cache
    openexr/3.2.3#cc76d7ca85ee7dfe03114eaa2a8e8c1b - Cache
    openh264/2.3.1#8b94a94f5472b67355953c7748ad4381 - Cache
    openjpeg/2.5.0#2886244f2492121aa7c6c493a814db06 - Cache
    openssl/3.2.1#c7b554068caae5eda12b735ea6f23d70 - Cache
    opus/1.4#54631f551fc450783fb2df8cd63f80a2 - Cache
    protobuf/3.21.12#ff413e7c6d81724e872661875af83e68 - Cache
    pulseaudio/14.2#bedb313afed20242c7caa27ae3e10af8 - Cache
    quirc/1.2#92179dd521786aea0729f2c859cbbcb9 - Cache
    vaapi/system#9fa40059fb979af4f9b301b84fb2dfa1 - Cache
    vdpau/system#bdd7d010c4e3d8762a8f6f08a3cf6760 - Cache
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6 - Cache
    wayland/1.22.0#f8b8e3e2f83c354e4b3fdc93a10117b9 - Cache
    xkbcommon/1.6.0#beae333ebbe0c41bdc15862ccdad66f6 - Cache
    xkeyboard-config/system#57dd5c08e72ab06bc2ee0e756c0a2c41 - Cache
    xorg/system#f626cbdd0ba57d9c53bce2d8b9362fad - Cache
    xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache
    zstd/1.5.5#e03fb7b37b87f0174e9db4a8407e3f4d - Cache
Build requirements
    autoconf/2.71#f9307992909d7fb3df459340f1932809 - Cache
    automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache
    bison/3.8.2#ed1ba0c42d2ab7ab64fc3a62e9ecc673 - Cache
    cmake/3.29.0#a055de871f63a7904aa3dcb9f3c61242 - Cache
    expat/2.6.0#2f92fb3cf504e9731aba6d20dcd641bf - Cache
    flex/2.6.4#e35bc44b3fcbcd661e0af0dc5b5b1ad4 - Cache
    gettext/0.21#1d4264880377c7b15562e071a538fda1 - Cache
    gnu-config/cci.20210814#dc430d754f465e8c74463019672fb97b - Cache
    libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache
    libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache
    libtool/2.4.7#08316dad5c72c541ed21e039e4cf217b - Cache
    libxml2/2.12.3#071b32ddc1353a239d3697319c68beca - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache
    meson/1.2.1#f641f02771e4660c772354736da0b9c6 - Cache
    meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache
    meson/1.3.0#67eebe98438326590a9285377c37cea2 - Cache
    meson/1.3.1#7134d7d69e15aaac836309abf62d53ec - Cache
    meson/1.3.2#d1125ba555ec1a94f165a3412fdf7f88 - Cache
    nasm/2.15.05#058c93b2214a49ca1cfe9f8f26205568 - Cache
    ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache
    pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache
    pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache
    protobuf/3.21.12#ff413e7c6d81724e872661875af83e68 - Cache
    wayland/1.22.0#f8b8e3e2f83c354e4b3fdc93a10117b9 - Cache
    wayland-protocols/1.33#b9e56b7662c2a25f30bfb4eb72df9ad6 - Cache
    yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694 - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache
Resolved version ranges
    cmake/[>=3.18 <4]: cmake/3.29.0
    cmake/[>=3.20 <4]: cmake/3.29.0
    libpng/[>=1.6 <2]: libpng/1.6.43
    openssl/[>=1.1 <4]: openssl/3.2.1
    zlib/[>=1.2.11 <2]: zlib/1.3.1

======== Computing necessary packages ========
ade/0.1.2d: Checking 9 compatible configurations
ade/0.1.2d: Main binary package '8ba5d903e072964e1ffb5590dcb6e372bbaa0442' missing. Using compatible package 'e49894dbdecadcada99ecd7d1f2cdf98fecabae0': compiler.cppstd=17
imath/3.1.9: Checking 9 compatible configurations
imath/3.1.9: Main binary package '8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe' missing. Using compatible package '13be611585c95453f1cbbd053cea04b3e64470ca': compiler.cppstd=17
libfdk_aac/2.0.3: Checking 11 compatible configurations
libfdk_aac/2.0.3: Main binary package '8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe' missing. Using compatible package '13be611585c95453f1cbbd053cea04b3e64470ca': compiler.cppstd=17
flac/1.4.2: Checking 11 compatible configurations
flac/1.4.2: Main binary package '01fe6dbfc4b61d1b87e784b3d1d1803b74a38466' missing. Using compatible package 'b8bb359ea6eee8ec25fcdfe71b4186677bd5c9a7': compiler.cppstd=17
libtiff/4.6.0: Checking 11 compatible configurations
libtiff/4.6.0: Main binary package '6328ea13bc011f46c31f08389a3e6535deb6c963' missing. Using compatible package '8141500ef0fe16b0b5a7ae18bd1ea1ba6d45de2c': compiler.cppstd=17
libvpx/1.13.1: Checking 11 compatible configurations
libvpx/1.13.1: Main binary package 'e10fb4590c7304b8906c173a647c2c5dd2e61b44' missing. Using compatible package '275028ea9406801538964e27356352bdcca64d50': compiler.cppstd=17
libx265/3.4: Checking 11 compatible configurations
libx265/3.4: Main binary package '3274b8e4cc0184b54606fc1d6486c83926c266f4' missing. Using compatible package 'd2481bc22012f35c7f6429eb902b3eb12b4924de': compiler.cppstd=17
openexr/3.2.3: Checking 9 compatible configurations
openexr/3.2.3: Main binary package 'f841f7832998896e1e40d076977fa31e717344a3' missing. Using compatible package '40f1ccee503ce0ea8dd3596e50de04ad9170922b': compiler.cppstd=17
openh264/2.3.1: Checking 11 compatible configurations
openh264/2.3.1: Main binary package '8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe' missing. Using compatible package '13be611585c95453f1cbbd053cea04b3e64470ca': compiler.cppstd=17
protobuf/3.21.12: Checking 11 compatible configurations
protobuf/3.21.12: Main binary package '16adb8fd5924f3e2f846fc02bb6374c9452669e1' missing. Using compatible package '10670e90b03eb1607902ed190ae2fecdc52d69bb': compiler.cppstd=17
libsndfile/1.2.2: Checking 11 compatible configurations
libsndfile/1.2.2: Main binary package '926041235ddaa3a983121414566faad581af0dd5' missing. Using compatible package 'f908b994399fc4c25d1bb440f118f76f7ad7d99f': compiler.cppstd=17
opencv/4.9.0: Checking 9 compatible configurations
opencv/4.9.0: Main binary package '8c2eb647c07ecfd6b47185767b524ffd6b291779' missing. Using compatible package '3dbc9e5c6ba8979c3f8e206caa2e1f16dd737349': compiler.cppstd=17
Requirements
    ade/0.1.2d#f225d0a218a7c9fbb81746806c7de53d:e49894dbdecadcada99ecd7d1f2cdf98fecabae0#7c0bb637e49c37469eccc0ece5a5037c - Cache
    autoconf/2.71#f9307992909d7fb3df459340f1932809:da39a3ee5e6b4b0d3255bfef95601890afd80709#5b77f70c17ad1741f5845d4e468a347e - Cache
    automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50:9a4eb3c8701508aa9458b1a73d0633783ecc2270#9719e51a6a62041af6a63e00eef35434 - Cache
    brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:5b903b7d3547e48038c8edfc531cf76728b899e8#bf102045d25236e2d81376e0e48604cd - Cache
    bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:763ddd53d7a4775fe84a285f56005a096d9786fd#53f22895547ac66130effcf590404b46 - Cache
    dav1d/1.2.1#94259c8baa2b1e7ab9976f1c20822be8:836daea00385a783c1aa7881c0744ec153bf4d85#8a558e84c5e99e207a88c64ff564ee41 - Cache
    expat/2.6.0#2f92fb3cf504e9731aba6d20dcd641bf:2ed03cd8691ea01deb11f88b5c95aa5195ec4816#be75d200f59b557478a4e7792bcc7e2e - Cache
    ffmpeg/4.4.4#0e4bd98a7a3303ae108adb9940f9ec3f:8128296b59bd2180eb95afc2ecf49938ac7cae65#2d403b0327f33bd1f5b38ed52b40e175 - Cache
    flac/1.4.2#6a17595ab773d2de32e18b5d3b24afff:b8bb359ea6eee8ec25fcdfe71b4186677bd5c9a7#c94596c5da3ed86514496984b456502c - Cache
    freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498:739e41967cd8e90e567861f59c4c6a1087fe7977#9ec38a53fe729b5396239d0007e34808 - Cache
    imath/3.1.9#2e7f5802b247baae47235b4c8d5642c9:13be611585c95453f1cbbd053cea04b3e64470ca#b6887feedfe1e9563a5593fac1e81532 - Cache
    jasper/4.2.0#bbda6a34e0a3d3e9caff91c15f632902:f04e48192e58df8676c97910743b56ffa30159e2#9e6f2e3580199cfd131839a0db38efc5 - Cache
    jbig/20160605#2d29fa02aacd76902e0d2cbbc24631ef:d529a33abf04a079c05de395d985d1a67619d741#3f360af5e9436f349a68fa935680ed69 - Cache
    libalsa/1.2.10#8b568d62190ef588cd5dcdd81171c289:5fa9eb432b28b79c0246ad3b98d042ed84a2b1ca#c1bb5d98e4f7ee95ed4c053d78b098d1 - Cache
    libaom-av1/3.6.1#a569b342c6f8129cf327709e18691072:dd36642efcc9a822884cb0c7a6b6a62ccf2d071b#06f926f01763ac91c7fdc9c4153d5b48 - Cache
    libcap/2.69#7ef2d60864c2e58e89db957be936dc49:e394d65b8a668d2483958bc3fb8d1c2c1729493b#3c3933c66c034c965f4630aab05876f8 - Cache
    libdeflate/1.19#3ea74a4549efc14d4b1202dc4bfbf602:b647c43bfefae3f830561ca202b6cfd935b56205#9bc4c23d5a533af536148055c70acce8 - Cache
    libfdk_aac/2.0.3#a4041d75d31de57214adeb9c6f9cae26:13be611585c95453f1cbbd053cea04b3e64470ca#26af56a12873195dea8ff0cbb7d169db - Cache
    libffi/3.4.4#35eb63842b505824b70aedc1baefc916:b647c43bfefae3f830561ca202b6cfd935b56205#7b5469e918452bad6747b9fd478b37a7 - Cache
    libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:b647c43bfefae3f830561ca202b6cfd935b56205#4fd44fefea7c20a6b0f1826c2b875a8c - Cache
    libjpeg/9e#68269859e4325ddc3f995d1fd3fc9187:b647c43bfefae3f830561ca202b6cfd935b56205#56f2c1d03929a9c088a0994c1be8f0b8 - Cache
    libmp3lame/3.100#44b12d19316eb2b223d98d3e75dae438:b647c43bfefae3f830561ca202b6cfd935b56205#82323ff769c108f6dfb11bab369186b1 - Cache
    libpng/1.6.43#c219d8f01983bac10c404fc613605eef:19b397f6e54f5b8b2c6f7b81c4dce4c52d386e4f#44ab6317da9a4de57b496f30f36ba4f7 - Cache
    libsndfile/1.2.2#b3662f832e29507e8d9840a43737cc14:f908b994399fc4c25d1bb440f118f76f7ad7d99f#04c7be41a5fb12bbef56e1bdf7c06812 - Cache
    libtiff/4.6.0#51d0e7e15d032aeec1b64e65c44ecd9f:8141500ef0fe16b0b5a7ae18bd1ea1ba6d45de2c#9cfbc4384bc6f5b5d201fe63c2bf2334 - Cache
    libtool/2.4.7#08316dad5c72c541ed21e039e4cf217b:b647c43bfefae3f830561ca202b6cfd935b56205#f4c8da5bffcf49cdf1b4ce011cab7737 - Cache
    libvpx/1.13.1#31c5cc0bc9fff2b5baf5a1fac60bd9c9:275028ea9406801538964e27356352bdcca64d50#50ff95c09ee39eb08661c078029745cd - Cache
    libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38:18f01a3f175888d5e3d128efe30c14773afadc83#e55816e5d48a3854454abdc32720bcad - Cache
    libx264/cci.20220602#310132b8f365d0d74028128d3677f132:8e4079910145c3e45cb15e603514b075788d75c7#6dc74ae3d1028567003e133312dca8a8 - Cache
    libx265/3.4#60fd8f9d5a93fd2338a46a0664ddc768:d2481bc22012f35c7f6429eb902b3eb12b4924de#7ccb7f2168e3d5677c78607ba04c6e1b - Cache
    libxml2/2.12.3#071b32ddc1353a239d3697319c68beca:835058a17375647fa8abeb3ed1b1faf0ef8f504f#07d12e49440afe2a7123cba752e32931 - Cache
    m4/1.4.19#b38ced39a01e31fef5435bc634461fd2:3593751651824fb813502c69c971267624ced41a#cd8019a4f9b70880d548f7cc26569604 - Cache
    mpg123/1.31.2#ce831c936b2284e2066ab3dc58a2628e:cd3321362832070e917e6965cd88f846ae82dcde#af693051b29a0ddacb0cc579fef7906e - Cache
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef:b647c43bfefae3f830561ca202b6cfd935b56205#eb65b3e6ebe9c8667bc03f5638e4b3dd - Cache
    opencv/4.9.0#fadd44c87e06cd62e207b1b7e580b293:3dbc9e5c6ba8979c3f8e206caa2e1f16dd737349#2e1682d6eb45004a858774cff2a4f637 - Cache
    openexr/3.2.3#cc76d7ca85ee7dfe03114eaa2a8e8c1b:40f1ccee503ce0ea8dd3596e50de04ad9170922b#99f26a4c66d84a0842197d658c1f4278 - Cache
    openh264/2.3.1#8b94a94f5472b67355953c7748ad4381:13be611585c95453f1cbbd053cea04b3e64470ca#71730a85b504776fc74b10f37a55db7f - Cache
    openjpeg/2.5.0#2886244f2492121aa7c6c493a814db06:b647c43bfefae3f830561ca202b6cfd935b56205#91f0115d44707bb91b83e26c19937bf8 - Cache
    openssl/3.2.1#c7b554068caae5eda12b735ea6f23d70:ba0c965640dfc9185194d683d05bfbe6419b47a3#d1726bfc4b66d9392fb7e73a90ed3d9c - Cache
    opus/1.4#54631f551fc450783fb2df8cd63f80a2:4df585f63ebee00f46c117ab89b69f931e4b3d26#ea184fe0fbc1bb3e18c551df32da5002 - Cache
    protobuf/3.21.12#ff413e7c6d81724e872661875af83e68:10670e90b03eb1607902ed190ae2fecdc52d69bb#cf81c3658abf202d94bfa9ad0798a2af - Cache
    pulseaudio/14.2#bedb313afed20242c7caa27ae3e10af8:3ccd173ab917968fc66c7121dcd52e8388a1ed47#ed3c4fde2d64919af7562ba0acb46284 - Cache
    quirc/1.2#92179dd521786aea0729f2c859cbbcb9:2923dea4049294bf613203302e8065f31f47de77#09e54b6aaa6b03ef760822373e1be6d5 - Cache
    vaapi/system#9fa40059fb979af4f9b301b84fb2dfa1:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    vdpau/system#bdd7d010c4e3d8762a8f6f08a3cf6760:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6:a7b68b4d31174eb97fff2f0a35ab28a9c1fd5e42#c6d1add45a7ed260effeef5dcb198e98 - Cache
    wayland/1.22.0#f8b8e3e2f83c354e4b3fdc93a10117b9:9ef61cfe051f69b8cce843b72e11408e15171fab#d9652c9c1071740af9cc8cc762c94634 - Cache
    xkbcommon/1.6.0#beae333ebbe0c41bdc15862ccdad66f6:24060eb1e52f1ce13c6102f08ed64ce54503c767#d534efc83efdd3fb0b9e7cb274419239 - Cache
    xkeyboard-config/system#57dd5c08e72ab06bc2ee0e756c0a2c41:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    xorg/system#f626cbdd0ba57d9c53bce2d8b9362fad:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad:b647c43bfefae3f830561ca202b6cfd935b56205#138de75176063b63b5390d111d4af0e2 - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:b647c43bfefae3f830561ca202b6cfd935b56205#6b307bbcbae23635c4006543ffdbf3ef - Cache
    zstd/1.5.5#e03fb7b37b87f0174e9db4a8407e3f4d:c1b14c3945d5adf1e5ae440c43c12f88117f2edc#d4e69a516749aae8c355562cb3c3ad7f - Cache
Build requirements
Skipped binaries
    eigen/3.4.0, autoconf/2.71, automake/1.16.5, bison/3.8.2, cmake/3.29.0, expat/2.6.0, flex/2.6.4, gettext/0.21, gnu-config/cci.20210814, libffi/3.4.4, libiconv/1.17, libtool/2.4.7, libxml2/2.12.3, m4/1.4.19, meson/1.2.1, meson/1.2.2, meson/1.3.0, meson/1.3.1, meson/1.3.2, nasm/2.15.05, ninja/1.11.1, pkgconf/2.0.3, pkgconf/2.1.0, protobuf/3.21.12, wayland-protocols/1.33, wayland/1.22.0, yasm/1.3.0, zlib/1.3.1
vaapi/system: System requirements:  already installed
vdpau/system: System requirements:  already installed
xkeyboard-config/system: System requirements:  already installed
xorg/system: System requirements:  already installed
xorg/system: System requirements:  already installed

======== Installing packages ========
ade/0.1.2d: Already installed! (1 of 53)
brotli/1.1.0: Already installed! (2 of 53)
bzip2/1.0.8: Already installed! (3 of 53)
expat/2.6.0: Already installed! (4 of 53)
imath/3.1.9: Already installed! (5 of 53)
jbig/20160605: Already installed! (6 of 53)
libaom-av1/3.6.1: Already installed! (7 of 53)
libcap/2.69: Already installed! (8 of 53)
libdeflate/1.19: Already installed! (9 of 53)
libfdk_aac/2.0.3: Already installed! (10 of 53)
libffi/3.4.4: Already installed! (11 of 53)
libiconv/1.17: Already installed! (12 of 53)
libjpeg/9e: Already installed! (13 of 53)
libwebp/1.3.2: Already installed! (14 of 53)
m4/1.4.19: Already installed! (15 of 53)
ogg/1.3.5: Already installed! (16 of 53)
openjpeg/2.5.0: Already installed! (17 of 53)
opus/1.4: Already installed! (18 of 53)
quirc/1.2: Already installed! (19 of 53)
vaapi/system: Already installed! (20 of 53)
vdpau/system: Already installed! (21 of 53)
xkeyboard-config/system: Already installed! (22 of 53)
xorg/system: Already installed! (23 of 53)
xz_utils/5.4.5: Already installed! (24 of 53)
zlib/1.3.1: Already installed! (25 of 53)
zstd/1.5.5: Already installed! (26 of 53)
libmp3lame/3.100: Already installed! (27 of 53)
libvpx/1.13.1: Already installed! (28 of 53)
libx264/cci.20220602: Already installed! (29 of 53)
libx265/3.4: Already installed! (30 of 53)
openh264/2.3.1: Already installed! (31 of 53)
dav1d/1.2.1: Already installed! (32 of 53)
mpg123/1.31.2: Already installed! (33 of 53)
mpg123/1.31.2: Appending PATH environment variable: /config/.conan2/p/mpg12d35da3a7a5ab9/p/bin
libalsa/1.2.10: Already installed! (34 of 53)
autoconf/2.71: Already installed! (35 of 53)
flac/1.4.2: Already installed! (36 of 53)
flac/1.4.2: Appending PATH environment variable: /config/.conan2/p/flac14b90fabbd015/p/bin
jasper/4.2.0: Already installed! (37 of 53)
libpng/1.6.43: Already installed! (38 of 53)
libtiff/4.6.0: Already installed! (39 of 53)
openexr/3.2.3: Already installed! (40 of 53)
openssl/3.2.1: Already installed! (41 of 53)
protobuf/3.21.12: Already installed! (42 of 53)
vorbis/1.3.7: Already installed! (43 of 53)
libxml2/2.12.3: Already installed! (44 of 53)
libxml2/2.12.3: Appending PATH environment variable: /config/.conan2/p/libxmac51c7767412f/p/bin
automake/1.16.5: Already installed! (45 of 53)
freetype/2.13.2: Already installed! (46 of 53)
libsndfile/1.2.2: Already installed! (47 of 53)
wayland/1.22.0: Already installed! (48 of 53)
libtool/2.4.7: Already installed! (49 of 53)
libtool/2.4.7: WARN: The use of 'unix_path_legacy_compat' is deprecated in Conan 2.0 and does not perform path conversions. This is retained for compatibility with Conan 1.x and will be removed in a future version.
libtool/2.4.7: WARN: The use of 'unix_path_legacy_compat' is deprecated in Conan 2.0 and does not perform path conversions. This is retained for compatibility with Conan 1.x and will be removed in a future version.
xkbcommon/1.6.0: Already installed! (50 of 53)
pulseaudio/14.2: Already installed! (51 of 53)
ffmpeg/4.4.4: Already installed! (52 of 53)
opencv/4.9.0: Already installed! (53 of 53)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'cpp_info.build_modules' used in: protobuf/3.21.12, bzip2/1.0.8, openssl/3.2.1, ade/0.1.2d, openjpeg/2.5.0, libxml2/2.12.3, freetype/2.13.2, jasper/4.2.0, xz_utils/5.4.5, opencv/4.9.0
WARN: deprecated:     'cpp_info.names' used in: flac/1.4.2, mpg123/1.31.2, openjpeg/2.5.0, zstd/1.5.5, libx264/cci.20220602, freetype/2.13.2, xz_utils/5.4.5, imath/3.1.9, ogg/1.3.5, libalsa/1.2.10, libsndfile/1.2.2, bzip2/1.0.8, brotli/1.1.0, libjpeg/9e, xkbcommon/1.6.0, zlib/1.3.1, libxml2/2.12.3, libwebp/1.3.2, libiconv/1.17, libtiff/4.6.0, expat/2.6.0, openexr/3.2.3, vorbis/1.3.7, opus/1.4, libfdk_aac/2.0.3, libpng/1.6.43, protobuf/3.21.12, libdeflate/1.19, openssl/3.2.1, jasper/4.2.0, opencv/4.9.0
WARN: deprecated:     'env_info' used in: flac/1.4.2, mpg123/1.31.2, libtool/2.4.7, zstd/1.5.5, freetype/2.13.2, libalsa/1.2.10, bzip2/1.0.8, wayland/1.22.0, xkbcommon/1.6.0, m4/1.4.19, libxml2/2.12.3, libiconv/1.17, dav1d/1.2.1, autoconf/2.71, openexr/3.2.3, automake/1.16.5, protobuf/3.21.12, openssl/3.2.1, jbig/20160605, libsndfile/1.2.2
WARN: deprecated:     'cpp_info.filenames' used in: flac/1.4.2, protobuf/3.21.12, mpg123/1.31.2, libfdk_aac/2.0.3, libxml2/2.12.3, freetype/2.13.2, opencv/4.9.0
WARN: deprecated:     'user_info' used in: freetype/2.13.2, automake/1.16.5

======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to /config/workspace/lib_v2/build/Release/generators
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(OpenCV)
    target_link_libraries(... opencv::opencv)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/config/workspace/lib/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
conanfile.txt: CMakeToolchain generated: CMakePresets.json
conanfile.txt: CMakeToolchain generated: ../../../CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished successfully

Build input: make all using the following makefile:

setup:
    conan install . --build=missing
build:
    pipx run build

install:
    pip install .

all: setup build install
memsharded commented 7 months ago

Thanks for the feedback.

I'd say the problem is that the toolchain is not being passed:

loading initial cache file /tmp/tmp4h2_fer5/build/CMakeInit.txt
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0

Here, you should typically see a message that the toolchain is passed.

You have hints how to execute it in the output too, at the end:

conanfile.txt: Preset 'conan-release' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-release' if using CMake>=3.23
conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/config/workspace/lib/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
con

Depending if you can/want to use presets (works great, very convenient), or need to pass the toolchain directly in case of older CMake versions.

davidelahoz commented 7 months ago

Thanks pointing that out. The problem was that I hadn't configured correctly the pyproject.toml file required for building the wheel. Adding the following section solved it:

[tool.scikit-build]
sdist.cmake = true
cmake.version = ">=3.23"
cmake.build-type = "Release"
cmake.args = ["--preset conan-release", "-G Ninja"]
memsharded commented 7 months ago

cmake.args = ["--preset conan-release", "-G Ninja"]

That makes sense, the conan-release preset includes the conan_toolchain.cmake that contains the paths so the dependencies are found by find_package() calls.

Regarding "-G Ninja" please be aware that in some cases it is necessary to let Conan know at install time about it with -c tools.cmake.cmaketoolchain:generator=Ninja, specially if the layout is defined.

Thanks for the feedback!

davidelahoz commented 7 months ago

Thanks again! I'll add that just in case I get errors in the future due to ninja