Search code examples
conan

Cant create boost conan package from conan-center-index - "conanfile didn't specify version"


I try to create conan package of boost library.

I got the recipe from https://github.com/conan-io/conan-center-index/tree/master/recipes/boost

When I execute command:

conan create . conan/stable

next error will appeared:

ERROR: conanfile didn't specify version

I see, that in recipe no version member, but I don't understand how to specify it manually in that case. And no any hint from official docs on conan create page(


Solution

  • Indeed the version is not listed in the recipe, but why? Because the same recipe is re-used for any version, so Conan Center Index don't need to replicate the same recipe for each new version.

    All versions supported by Boost are listed in conandata.yml, which is a file with the download link and the checksum, according the version.

    Thus, to build the desired version, you have to pass it with the command like. For instance, to build Boost 1.73:

    cd recipes/boost/all
    conan create . 1.73.0@
    

    Note that I only passed the version, not the namespace (username/channel), because it's an official recipe from Conan Center Index, any other recipe should contain the namespace to avoid any conflict. In this case, you can use your namespace too, if you want:

    cd recipes/boost/all
    conan create . 1.73.0@hdnn/stable
    

    The version in recipe is not mandatory, even without conandata.yml. When any mandatory attribute is missing (name or version), you can pass them by command line.