conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
967 stars 1.78k forks source link

Cannot override requirement for tool_require. #12286

Open zbordas-kollective opened 2 years ago

zbordas-kollective commented 2 years ago

Environment Details (include every applicable attribute)

Steps to reproduce (Include if Applicable)

Create any project with a single dependency on grpc and the child dependency to protobuf cannot be resolved.

tool_requires = (
    "grpc/1.48.0"
)

requires = (
    "grpc/1.48.0"
)

Running conan produces an error:

ERROR: Conflict in googleapis/cci.20220711:
    'googleapis/cci.20220711' requires 'protobuf/3.21.4' while 'googleapis/cci.20220711' requires 'protobuf/3.21.1'.
    To fix this conflict you need to override the package 'protobuf' in your root package.

There is no way to resolve the conflict unless the dependency from tool_requires is removed. Putting any explicit version of protobuf (either version) into either 'tool_requires' or 'requires' has no effect on the end result.

Logs (Executed commands with output) (Include/Attach if Applicable)

Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

grpc/1.48.0: Not found in local cache, looking in remotes...
grpc/1.48.0: Trying with 'conancenter'...
...
protobuf/3.21.1: Not found in local cache, looking in remotes...
protobuf/3.21.1: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
protobuf/3.21.1: Downloaded recipe revision 0
googleapis/cci.20220711: Not found in local cache, looking in remotes...
googleapis/cci.20220711: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
googleapis/cci.20220711: Downloaded recipe revision 0
WARN: googleapis/cci.20220711: requirement protobuf/3.21.4 overridden by grpc/1.48.0 to protobuf/3.21.1 
grpc-proto/cci.20220627: Not found in local cache, looking in remotes...
grpc-proto/cci.20220627: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
grpc-proto/cci.20220627: Downloaded recipe revision 0
WARN: grpc-proto/cci.20220627: requirement protobuf/3.21.4 overridden by grpc/1.48.0 to protobuf/3.21.1 
...
protobuf/3.21.1: Main binary package 'b576dca07b87b673d32c6146a2a3722352ec639d' missing. Using compatible package '8851b661aa2b926e9f4a452660f085891b8aabff'
protobuf/3.21.4: Not found in local cache, looking in remotes...
protobuf/3.21.4: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
protobuf/3.21.4: Downloaded recipe revision 0
zlib/1.2.12: Main binary package '299aaabcb5fb1385c096ccf2c550a653c4438173' missing. Using compatible package 'e4fbacdee83eb1a2e68227ffe19f6e9a61b36cbc'
protobuf/3.21.4: Main binary package '9f1de7516e2ce4950e57e3dcce39eecb6938680d' missing. Using compatible package 'a68b48337784cbbfa52d25f15d209e461efe2cbf'
protobuf/3.21.1: Main binary package '9f1de7516e2ce4950e57e3dcce39eecb6938680d' missing. Using compatible package 'a68b48337784cbbfa52d25f15d209e461efe2cbf'
WARN: googleapis/cci.20220711: requirement protobuf/3.21.4 overridden by grpc/1.48.0 to protobuf/3.21.1 
WARN: grpc-proto/cci.20220627: requirement protobuf/3.21.4 overridden by grpc/1.48.0 to protobuf/3.21.1 
...
ERROR: Conflict in googleapis/cci.20220711:
    'googleapis/cci.20220711' requires 'protobuf/3.21.4' while 'googleapis/cci.20220711' requires 'protobuf/3.21.1'.
    To fix this conflict you need to override the package 'protobuf' in your root package.
memsharded commented 2 years ago

Hi @zbordas-kollective

tool_requires are private in recipes, and cannot be overriden from other downstream recipes. But they can be overriden if necessary by profiles.

I think in this case this is an inconsistency in recipes in conan-center-index, and recipes there should be updated to use the same protobuf/3.21.4 version, but for some reason grpc hasn't been updated yet.

I am transferring this issue to conan-center-index repo.

zbordas-kollective commented 2 years ago

Thank you very much for the response. Our project is set up for cross-compilation that's why we have a separate tool_requires list. Is there any way for us to mitigate the problem on our side other than enabling revisions and explicitly reference to specific revisions of the conflicting 3rd party packages?