cmake-conan
cmake-conan copied to clipboard
[bug] dev2 branch: Could NOT find OpenSSL
conan profile
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu23
compiler.libcxx=libstdc++11
compiler.version=12
os=Macos
[buildenv]
CC=/opt/homebrew/bin/gcc-12
CXX=/opt/homebrew/bin/g++-12
conan file
[requires]
openssl/1.1.1s
[generators]
CMakeDeps
CMakeToolchain
benben@benbendeMBP cpp_common % cmake -B build -S . -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=~/dev/cmake-conan/conan_provider.cmake -DCMAKE_BUILD_TYPE=Release
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- Conan: Component target declared 'spdlog::spdlog'
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- Conan: Component target declared 'fmt::fmt'
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
CMake Error at /opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args)
/Users/benben/dev/cmake-conan/conan_support.cmake:185 (find_package)
CMakeLists.txt:50 (find_package)
Hi @pwqbot
Thanks for your report.
The first important bit is that cmake-conan for Conan 2.0 doesn't use a profile for "host", but it will dynamically detect and define such profile from CXX in the environment first. The core idea of the cmake-conan integration is that it gets the settings from the current build. We might consider other ways to configure the build, but at the moment we want to iterate and stabilize the main use case. At the end of the day it doesn't matter if conan uses the CXX
you define in the profile if your current build doesn't use it, so you would need to define it for calling cmake
anyway.
Regarding the missing openssl
, it would be great to see the whole output of the command running, it might have more hints to what could be happening.
Hi @pwqbot
Thanks for your report.
The first important bit is that cmake-conan for Conan 2.0 doesn't use a profile for "host", but it will dynamically detect and define such profile from CXX in the environment first. The core idea of the cmake-conan integration is that it gets the settings from the current build. We might consider other ways to configure the build, but at the moment we want to iterate and stabilize the main use case. At the end of the day it doesn't matter if conan uses the
CXX
you define in the profile if your current build doesn't use it, so you would need to define it for callingcmake
anyway.Regarding the missing
openssl
, it would be great to see the whole output of the command running, it might have more hints to what could be happening.
Thanks! Here is the whole output, I have set CMAKE_CXX_COMLIER=g++
in my CMakeLists.txt.
benben@benbendeMBP cpp_common % cmake -B build -S . -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=~/dev/cmake-conan/conan_provider.cmake -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake-conan: first find_package() found. Installing dependencies with Conan
-- Conan-cmake: Checking if a default profile exists
/Users/benben/.conan2/profiles/default
-- Conan-cmake: cmake_system_name=Darwin
-- Conan-cmake: CMake compiler=GNU
-- Conan-cmake: CMake cmpiler version=12.2.0
-- Conan-cmake: [settings] compiler=gcc
-- Conan-cmake: [settings] compiler.version=12
-- Conan-cmake: Creating profile /Users/benben/dev/exec/cpp_common/build/conan_host_profile
-- Conan-cmake: Profile:
include(default)
[settings]
os=Macos
compiler=gcc
compiler.version=12
compiler.cppstd=23
build_type=Release
[conf]
tools.cmake.cmaketoolchain:generator=Unix Makefiles
-- CMake-conan: Installing single configuration Release
-- CMake-conan: conan install /Users/benben/dev/exec/cpp_common -of=/Users/benben/dev/exec/cpp_common/build/conan -pr;/Users/benben/dev/exec/cpp_common/build/conan_host_profile;--build=m
issing;-g;CMakeDeps
======== Input profiles ========
Profile host:
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=23
compiler.libcxx=libstdc++11
compiler.version=12
os=Macos
[conf]
tools.cmake.cmaketoolchain:generator=Unix Makefiles
[buildenv]
CC=/opt/homebrew/bin/gcc-12
CXX=/opt/homebrew/bin/g++-12
Profile build:
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.cppstd=gnu23
compiler.libcxx=libstdc++11
compiler.version=12
os=Macos
[buildenv]
CC=/opt/homebrew/bin/gcc-12
CXX=/opt/homebrew/bin/g++-12
======== Computing dependency graph ========
Graph root
conanfile.txt: /Users/benben/dev/exec/cpp_common/conanfile.txt
Requirements
fmt/9.1.0#e747928f85b03f48aaf227ff897d9634 - Cache
gtest/cci.20210126#dafbdf84b58cd687075ace7314651c1a - Cache
libcurl/7.88.1#923efa6a87100fae3bdcff13b226b7ed - Cache
openssl/1.1.1s#5449870f797dec26045f2765d6fc7b5a - Cache
spdlog/1.11.0#faa6eb03bd1009bf2070b0c77e4f56a6 - Cache
yaml-cpp/0.7.0#85b409c274a53d226b71f1bdb9cb4f8b - Cache
zlib/1.2.13#13c96f538b52e1600c40b88994de240f - Cache
Build requirements
autoconf/2.71#f4e2bd681d49b4b80761aa587bde94d5 - Cache
automake/1.16.5#891f585a736bce951cc0e7109aa5ffee - Cache
gnu-config/cci.20210814#eb941b98dbf40f3eb1753f6b1f05861f - Cache
libtool/2.4.7#d55a3c2435c19e830fa77aa5c6c19350 - Cache
m4/1.4.19#c1c4b1ee919e34630bb9b50046253d3c - Cache
meson/1.0.0#15586c0ac6f682805875ef903dbe7ee2 - Cache
ninja/1.11.1#a2f0b832705907016f336839f96963f8 - Cache
pkgconf/1.9.3#a920b5c7f8d04f22b9fe03db91a864dd - Cache
======== Computing necessary packages ========
fmt/9.1.0: Checking 9 compatible configurations:
fmt/9.1.0: '893176aec6efb2e0c92de0b7958a3c59d3e87943': compiler.cppstd=11
fmt/9.1.0: 'a696e06a27a292d4df429c6a40da60321528495e': compiler.cppstd=gnu11
fmt/9.1.0: 'b70448d6ccd2321f67d98874695f460871ff7b6b': compiler.cppstd=14
fmt/9.1.0: '6118513374d64c48b509a3c93181fef5d04f378b': compiler.cppstd=gnu14
fmt/9.1.0: '3d9ce2d5d653136ab45f9188a6629aa1c197d845': compiler.cppstd=17
fmt/9.1.0: 'ddb4e44787049ba6db7b55aee1215d6275266fec': compiler.cppstd=gnu17
fmt/9.1.0: 'f45b8f19a5c187d9a440ca69ba1b54c552850f91': compiler.cppstd=20
fmt/9.1.0: '9cd2cebd4ad88f73bbc08562cf3f1d37b28b0456': compiler.cppstd=gnu20
fmt/9.1.0: 'df6de5037857e488f7d8c28950df20d6641f4d27': compiler.cppstd=gnu23
fmt/9.1.0: Main binary package 'b93fb280bbaf8bb76d147a52e3bf86a7a65061b8' missing. Using compatible package 'df6de5037857e488f7d8c28950df20d6641f4d27'
gtest/cci.20210126: Checking 9 compatible configurations:
gtest/cci.20210126: '1abd2d8e36ca24f60f103afed5a488f72a1cc7b0': compiler.cppstd=11
gtest/cci.20210126: '1e9dc5ebaa1a1b0e19cb73fcd0e74ef381c880d4': compiler.cppstd=gnu11
gtest/cci.20210126: '5cecbf13b8f53852a810275cbcd378ccd2114b00': compiler.cppstd=14
gtest/cci.20210126: '6306c814a045bc06e41ed44f5769874c8eb296eb': compiler.cppstd=gnu14
gtest/cci.20210126: '1ddb66c1eaa9722727b6283e8af4e8831c4fb18a': compiler.cppstd=17
gtest/cci.20210126: '0fbc085b3023dbde1589404151047db1ed668d28': compiler.cppstd=gnu17
gtest/cci.20210126: '736e8a04c131120516b37668b4178c6ad04053af': compiler.cppstd=20
gtest/cci.20210126: 'e0e75731c307c54ae99ea60ee69b50f68891e77f': compiler.cppstd=gnu20
gtest/cci.20210126: '213a03074a49a0e70413a8798ff6840c518a1df6': compiler.cppstd=gnu23
gtest/cci.20210126: Main binary package '1085d56676e08d4ff05802a47857f96f59643fd5' missing. Using compatible package '213a03074a49a0e70413a8798ff6840c518a1df6'
yaml-cpp/0.7.0: Checking 9 compatible configurations:
yaml-cpp/0.7.0: 'c3bad611915f2990fb8f967bcb17ce1339fff412': compiler.cppstd=11
yaml-cpp/0.7.0: 'b06683465a4ed9a066b18f609d796478481bcbb8': compiler.cppstd=gnu11
yaml-cpp/0.7.0: '4fe0b045a121fe2f48557710c62747a551c480be': compiler.cppstd=14
yaml-cpp/0.7.0: 'e6e32d220e05330f9663fa5f2727d2625e60953f': compiler.cppstd=gnu14
yaml-cpp/0.7.0: 'be0ba25a4ca0cab25b03983cb9bcc1d946af39c8': compiler.cppstd=17
yaml-cpp/0.7.0: '99056d3d28badf39c8aac1d163fe24154d34cf8c': compiler.cppstd=gnu17
yaml-cpp/0.7.0: '05a36f818323816d6c1bb5c87d179c560ed34f9c': compiler.cppstd=20
yaml-cpp/0.7.0: 'd23acd67153e21d9cb75c5442bc35674d760738b': compiler.cppstd=gnu20
yaml-cpp/0.7.0: '77dba3913a9a9d1d726556f5501c3e0f62661c7d': compiler.cppstd=gnu23
yaml-cpp/0.7.0: Main binary package 'd000a4e6de31a19e1d20acc52c74a45f3df3ab63' missing. Using compatible package '77dba3913a9a9d1d726556f5501c3e0f62661c7d'
spdlog/1.11.0: Checking 9 compatible configurations:
spdlog/1.11.0: 'fdd8034cfaf72ea0f7b4b4b0d917e1d8d77cfc6d': compiler.cppstd=11
spdlog/1.11.0: '8c4badb7459cbf28d8fcaa0b4ad7892892fc5c74': compiler.cppstd=gnu11
spdlog/1.11.0: '0aa16751821e3aef397fa09f8a687022b942a0f8': compiler.cppstd=14
spdlog/1.11.0: 'df2b040fcac2cae4f34c4e6a5ca57c467ba9df3e': compiler.cppstd=gnu14
spdlog/1.11.0: 'd83cb90ea21be0d020e3d3ffe5882307672dd820': compiler.cppstd=17
spdlog/1.11.0: '25609cdc7183c337d85ae6a3942c7c401cc15c83': compiler.cppstd=gnu17
spdlog/1.11.0: '9ec63643c71f09883e517baaf716b0557fd2d422': compiler.cppstd=20
spdlog/1.11.0: 'aea864763783f1e171dbefe0a88f8ccfc65930d1': compiler.cppstd=gnu20
spdlog/1.11.0: '88c5b9ca5a78803cca08ada2047b592484ddf971': compiler.cppstd=gnu23
spdlog/1.11.0: Main binary package '43682a79b65e963b92173667b4c752426efb3bff' missing. Using compatible package '88c5b9ca5a78803cca08ada2047b592484ddf971'
Requirements
fmt/9.1.0#e747928f85b03f48aaf227ff897d9634:df6de5037857e488f7d8c28950df20d6641f4d27#ed3d56e5b3014d409c7bce0532a819b9 - Cache
gtest/cci.20210126#dafbdf84b58cd687075ace7314651c1a:213a03074a49a0e70413a8798ff6840c518a1df6#6dc7b6b253939ebf1f4a0ee0031268eb - Cache
libcurl/7.88.1#923efa6a87100fae3bdcff13b226b7ed:3b7b1c66dd16f2fb1c8fa9318519ce0a3ce34d82#dfae0a5bcf32bc03d9ffc2fc88877132 - Cache
openssl/1.1.1s#5449870f797dec26045f2765d6fc7b5a:8756d663c68248230f01db3ffde4c1c97928a263#868dda7f2f7a2ce1c57be07635eae260 - Cache
spdlog/1.11.0#faa6eb03bd1009bf2070b0c77e4f56a6:88c5b9ca5a78803cca08ada2047b592484ddf971#0a29de28d3d77f524883afcbbc0f5779 - Cache
yaml-cpp/0.7.0#85b409c274a53d226b71f1bdb9cb4f8b:77dba3913a9a9d1d726556f5501c3e0f62661c7d#63c313ba2bf5c85e2f0473896407d558 - Cache
zlib/1.2.13#13c96f538b52e1600c40b88994de240f:8254890804d12db52ab8e234888a85b7c797890f#9a1a8bb3a17cd7cd27c263838cec2b9c - Cache
Build requirements
autoconf/2.71#f4e2bd681d49b4b80761aa587bde94d5:da39a3ee5e6b4b0d3255bfef95601890afd80709#5c53a519d70fdb79d3cd4145e9f0355f - Skip
automake/1.16.5#891f585a736bce951cc0e7109aa5ffee:9e5323c65b94ae38c3c733fe12637776db0119a5#53e724e4596a55dd2b2a3931d36256dc - Skip
gnu-config/cci.20210814#eb941b98dbf40f3eb1753f6b1f05861f:da39a3ee5e6b4b0d3255bfef95601890afd80709#0d678e64f84cc730eaf93b400db0864f - Skip
libtool/2.4.7#d55a3c2435c19e830fa77aa5c6c19350:8254890804d12db52ab8e234888a85b7c797890f#9271281436eb8e5f203770f1226619f6 - Skip
m4/1.4.19#c1c4b1ee919e34630bb9b50046253d3c:617cae191537b47386c088e07b1822d8606b7e67#af3bb664b82c4f616d3146625c5b4bd5 - Skip
meson/1.0.0#15586c0ac6f682805875ef903dbe7ee2:da39a3ee5e6b4b0d3255bfef95601890afd80709#5c8fd51fc33f12e26519674d99afd0e5 - Skip
ninja/1.11.1#a2f0b832705907016f336839f96963f8:617cae191537b47386c088e07b1822d8606b7e67#c91372a33f74405b60f9f71b2163a290 - Skip
pkgconf/1.9.3#a920b5c7f8d04f22b9fe03db91a864dd:df7e47c8f0b96c79c977dd45ec51a050d8380273#ffb7995c86a762b52da14de294154467 - Skip
======== Installing packages ========
fmt/9.1.0: Already installed! (1 of 7)
gtest/cci.20210126: Already installed! (2 of 7)
openssl/1.1.1s: Already installed! (3 of 7)
yaml-cpp/0.7.0: Already installed! (4 of 7)
zlib/1.2.13: Already installed! (5 of 7)
spdlog/1.11.0: Already installed! (6 of 7)
libcurl/7.88.1: Already installed! (7 of 7)
WARN: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: 'cpp_info.names' used in: zlib/1.2.13, spdlog/1.11.0, fmt/9.1.0, openssl/1.1.1s, libcurl/7.88.1, gtest/cci.20210126
WARN: 'cpp_info.build_modules' used in: yaml-cpp/0.7.0, openssl/1.1.1s
======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to /Users/benben/dev/exec/cpp_common/build/conan
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
Install finished succesfully
-- CMake-conan: CONAN_GENERATORS_FOLDER=/Users/benben/dev/exec/cpp_common/build/conan
-- Conan: Component target declared 'spdlog::spdlog'
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- Conan: Component target declared 'fmt::fmt'
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
-- CMake-conan: find_package(FIND_PACKAGE) found, 'conan install' aready ran
CMake Error at /opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/Cellar/cmake/3.25.3/share/cmake/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args)
/Users/benben/dev/cmake-conan/conan_support.cmake:185 (find_package)
CMakeLists.txt:50 (find_package)
-- Configuring incomplete, errors occurred!
See also "/Users/benben/dev/exec/cpp_common/build/CMakeFiles/CMakeOutput.log".
And I use
find_package(OpenSSL REQUIRED)
to search for OpenSSL. It works well If I just use normal conan install and then cmake build.
Thanks, we will have a look at this.
A couple of observations, also for @jcar87
- It is not great that our default inclusion of
include(default)
is bringing hardcoded CC/CXX env-vars, which can contradict what has been defined tocmake-conan
. I will open a ticket specific for this. - Are you sure the
conanfile.txt
you shared is the one that creates that output? Doesopenssl
bring so many dependencies? I am a bit surprised about this.
Thanks, we will have a look at this.
A couple of observations, also for @jcar87
- It is not great that our default inclusion of
include(default)
is bringing hardcoded CC/CXX env-vars, which can contradict what has been defined tocmake-conan
. I will open a ticket specific for this.- Are you sure the
conanfile.txt
you shared is the one that creates that output? Doesopenssl
bring so many dependencies? I am a bit surprised about this.
I'm sorry, the whole conanfile.txt
is
[requires]
spdlog/1.11.0
libcurl/7.88.1
gtest/cci.20210126
yaml-cpp/0.7.0
fmt/9.1.0
openssl/1.1.1s
[generators]
CMakeDeps
CMakeToolchain
And I guess that it is possible to reproduce the problem, just by dropping everything and leaving openssl
only, isn't it?
Hi @pwqbot - thank you for trying out the new integration and reporting this issue.
The error you are seeing is related to one of the current limitations mentioned in the readme, where the FindOpenSSL.cmake
cmake module is making calls to find_library
and related functions. Support for this is set up by the Conan-generated toolchain, which is not loaded when using the dependency provider.
I believe we can fix this and overcome this limitation. In the meantime, I believe the following would be a valid workaround, if you can change your CMakeLists:
find_package(OpenSSL CONFIG REQUIRED)
Hi @pwqbot - thank you for trying out the new integration and reporting this issue.
The error you are seeing is related to one of the current limitations mentioned in the readme, where the
FindOpenSSL.cmake
cmake module is making calls tofind_library
and related functions. Support for this is set up by the Conan-generated toolchain, which is not loaded when using the dependency provider.I believe we can fix this and overcome this limitation. In the meantime, I believe the following would be a valid workaround, if you can change your CMakeLists:
find_package(OpenSSL CONFIG REQUIRED)
This solution works, Thanks so much!
And I guess that it is possible to reproduce the problem, just by dropping everything and leaving
openssl
only, isn't it?
Thanks! @jcar87 expained this problem and gave a solution works for me.