Issue
I'm trying to make a very simple example using Conan. Here are my steps:
Directory Structure
.
├── build
├── CMakeLists.txt
├── conanfile.txt
└── main.cpp
main.cpp
#include <iostream>
#include <curl/curl.h>
int main(int argc, char** argv) {
std::cout << "Hello World" << std::endl;
return 0;
}
conanfile.txt
[requires]
libcurl/7.77.0
[generators]
CMakeDeps
CMakeToolchain
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(Conan2 CXX)
find_package(CURL CONFIG REQUIRED)
add_executable(App main.cpp)
target_link_libraries(App CURL::libcurl)
$ cd build
$ conan install ..
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
======== Computing dependency graph ========
Graph root
conanfile.txt: /home/qwe/NoteX/Conan/2/conanfile.txt
Requirements
libcurl/7.77.0#fa792ade05b92058672e6fc91d442ffb - Cache
openssl/3.1.3#fff5e82eb893e0c6ab135df0e60b894f - Cache
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1 - Cache
Build requirements
autoconf/2.71#53be95d228b2dcb30dc199cb84262d8f - Cache
automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache
gnu-config/cci.20210814#15c3bf7dfdb743977b84d0321534ad90 - Cache
libtool/2.4.7#d55a3c2435c19e830fa77aa5c6c19350 - Cache
m4/1.4.19#adbdd7fb7db33e609425c797196baccb - Cache
meson/1.2.2#aace9dcc1db58fa42ecb5292f724092d - Cache
ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache
pkgconf/1.9.3#3e658ebc066dc868a1f8a472c1065368 - Cache
Resolved version ranges
openssl/[>=1.1 <4]: openssl/3.1.3
======== Computing necessary packages ========
Requirements
libcurl/7.77.0#fa792ade05b92058672e6fc91d442ffb:a66c168cd0b825324f775fad7b3886c2d22225c3 - Missing
openssl/3.1.3#fff5e82eb893e0c6ab135df0e60b894f:2b010f4baf8e367a9e2df7f714b35852aa8fa5aa - Missing
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1:72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a - Missing
Build requirements
Skipped binaries
autoconf/2.71, automake/1.16.5, gnu-config/cci.20210814, libtool/2.4.7, m4/1.4.19, meson/1.2.2, ninja/1.11.1, pkgconf/1.9.3
======== Installing packages ========
ERROR: Missing binary: libcurl/7.77.0:a66c168cd0b825324f775fad7b3886c2d22225c3
ERROR: Missing binary: openssl/3.1.3:2b010f4baf8e367a9e2df7f714b35852aa8fa5aa
ERROR: Missing binary: zlib/1.2.13:72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a
zlib/1.2.13: WARN: Can't find a 'zlib/1.2.13' package binary '72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a' for the configuration:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.version=9
os=Linux
[options]
fPIC=True
shared=False
ERROR: Missing prebuilt package for 'libcurl/7.77.0', 'openssl/3.1.3', 'zlib/1.2.13'
Check the available packages using 'conan list zlib/1.2.13:* -r=remote'
or try to build locally from sources using the '--build=libcurl/7.77.0 --build=openssl/3.1.3 --build=zlib/1.2.13' argument
More Info at 'https://docs.conan.io/2/knowledge/faq.html#error-missing-prebuilt-package'
Lets check Are there really these packages in ConanCenter or not?
$ conan search zlib/1.2.13 -r=conancenter
conancenter
zlib
zlib/1.2.13
$ conan search openssl/3.1.3 -r=conancenter
conancenter
openssl
openssl/3.1.3
As you can see with the search command above, it gives the error below even though it is in conancenter.
ERROR: Missing prebuilt package for 'libcurl/7.77.0', 'openssl/3.1.3', 'zlib/1.2.13' Check the available packages using 'conan list zlib/1.2.13:* -r=remote' or try to build locally from sources using the '--build=libcurl/7.77.0 --build=openssl/3.1.3 --build=zlib/1.2.13' argument
More Info at 'https://docs.conan.io/2/knowledge/faq.html#error-missing-prebuilt-package'
First Edit
When i build manually, it gives another error.
$ conan install .. --build=libcurl/7.77.0 --build=openssl/3.1.3 --
build=zlib/1.2.13
======== Installing packages ========
ERROR: Missing binary: libtool/2.4.7:72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a
libtool/2.4.7: WARN: Can't find a 'libtool/2.4.7' package binary '72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a' for the configuration:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.version=9
os=Linux
[options]
fPIC=True
shared=False
ERROR: Missing prebuilt package for 'libtool/2.4.7'
Check the available packages using 'conan list libtool/2.4.7:* -r=remote'
or try to build locally from sources using the '--build=libtool/2.4.7' argument
More Info at 'https://docs.conan.io/2/knowledge/faq.html#error-missing-prebuilt-package'
Second edit
After build manually it compiles fine. After compiling what i done:
$ cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
$ cmake --build . --config Release
After above commands I was able to create the executable file successfully.
Solution
The Conan install command is showing your dependencies graph:
======== Computing dependency graph ========
Graph root
conanfile.txt: /home/qwe/NoteX/Conan/2/conanfile.txt
Requirements
libcurl/7.77.0#fa792ade05b92058672e6fc91d442ffb - Cache
openssl/3.1.3#fff5e82eb893e0c6ab135df0e60b894f - Cache
zlib/1.2.13#97d5730b529b4224045fe7090592d4c1 - Cache
And it says that you have those packages recipes cached already.
So, Conan will try to find a binary package with a package ID that matches your current profile
By default, Conan will use your cache to find that package, but as it does not exist in your machine, it will result on missing dependencies error. But you still can tell to Conan to use a remote as priority, instead of your cache, to look for that missing binary package. To do that, you need to pass --remote=<remote_name>
:
conan install --requires=zlib/1.3 -r conancenter
# or
conan install conanfile.txt -r conancenter
Here I told to Conan: Try to install zlib/1.3
from conancenter
first. Or, try to install anything listed in conanfile.txt
from the conancenter
first.
It should solve your case, because Conan Center does support GCC9, as listed in the supported configurations
About your second situation:
When i build manually, it gives another error.
$ conan install .. --build=libcurl/7.77.0 --build=openssl/3.1.3 --
build=zlib/1.2.13
======== Installing packages ========
ERROR: Missing binary: libtool/2.4.7:72c852c5f0ae27ca0b1741e5fd7c8b8be91a590a
Conan uses a dependencies graph to decide its build order, but when you said to build those packages, the libtool
is also listed in the graph and is missing too. To check the build order executed to build a package, you can run graph build-order command:
conan graph build-order --requires=libcurl/7.77.0
However, it could be boring solving all this, as you actually just want to install a package. So, to solve it automatically, you can pass --build=missing
. The missing
is a special word, that tells Conan to build what is missing in the graph only. But in case you want to build everything from source, you actually can pass --build=*
:
conan install conanfile.txt --build=missing --remote=conancenter
This command should solve your problem. It will install from Conan Center first, then what it does not find available, Conan will build from sources automatically.
Answered By - uilianries Answer Checked By - Pedro (WPSolving Volunteer)