Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] can't override version conflict in tool_requires #14719

Open
AndreyMlashkin opened this issue Sep 12, 2023 · 7 comments
Open

[bug] can't override version conflict in tool_requires #14719

AndreyMlashkin opened this issue Sep 12, 2023 · 7 comments
Assignees

Comments

@AndreyMlashkin
Copy link

Environment details

  • Operating System+version: Ubuntu 22.04
  • Compiler+version: gcc/12.2.0
  • Conan version: 2.0.10

Steps to reproduce

create a file requirements.txt

[tool_requires]
gcc/12.2.0
make/4.3
cmake/3.24.2
gmp/6.3.0

conan install requirements.txt --build missing

Logs


======== Computing dependency graph ========
gmp/6.3.0: Not found in local cache, looking in remotes...
gmp/6.3.0: Checking remote: conancenter
gmp/6.3.0: Downloaded recipe revision f925bd29cb8f70972507c699d681de85
m4/1.4.19: Not found in local cache, looking in remotes...
m4/1.4.19: Checking remote: conancenter
m4/1.4.19: Downloaded recipe revision c1c4b1ee919e34630bb9b50046253d3c
gcc/12.2.0: Not found in local cache, looking in remotes...
gcc/12.2.0: Checking remote: conancenter
gcc/12.2.0: Downloaded recipe revision e2965d35782138942e42af8e7da1faf7
mpc/1.2.0: Not found in local cache, looking in remotes...
mpc/1.2.0: Checking remote: conancenter
mpc/1.2.0: Downloaded recipe revision 3eb7f548f869fd782601e22fcf196a8c
Graph root
    requirements.txt: /requirements.txt
Build requirements
    gcc/12.2.0#e2965d35782138942e42af8e7da1faf7 - Downloaded (conancenter)
    gmp/6.3.0#f925bd29cb8f70972507c699d681de85 - Downloaded (conancenter)
    m4/1.4.19#c1c4b1ee919e34630bb9b50046253d3c - Downloaded (conancenter)
    mpc/1.2.0#3eb7f548f869fd782601e22fcf196a8c - Downloaded (conancenter)
ERROR: Version conflict: mpc/1.2.0->gmp/6.3.0, gcc/12.2.0->gmp/6.2.1.
@memsharded memsharded self-assigned this Sep 13, 2023
@memsharded
Copy link
Member

Hi @AndreyMlashkin

This issue has 2 sides:

  • On one side, if the recipe versions in ConanCenter are kind of the latest, the version conflict shouldn't happen in the first place. We are trying to improve that in ConanCenter, but it might take a while. In the meantime, updating packages in ConanCenter so they point to the same latest gmp version, would be very recommended and solve the issue
  • The other side, is the specification of overrides. Conan 1.X was introducing some issues with the automatic force/override of gmp/version, introducing a direct dependency to gmp/version that could have side effects. Conan 2.0 requires explicit overriding or force to gmp/version, to avoid introducing these issues. This override/force can be done with a conanfile.py, like:
def build_requirements(self):
    self.tool_requires("gmp/6.3.0", force=True)  # if gmp is really an executable we directly use
    self.requires("gmp/6.3.0", override=True)  # if gmp is only a library that I need to define upstream to solve conflicts

@AndreyMlashkin
Copy link
Author

So, it's not possible to do in a plain *.txt file?

@AndreyMlashkin
Copy link
Author

This works with conan v1 and does not work with conan v2:

from conan import ConanFile

class RequirementsConan(ConanFile):
    name = "Requirements"
    settings = "os", "compiler", "build_type", "arch"

    def build_requirements(self):
        self.tool_requires("gcc/12.2.0")
        self.tool_requires("make/4.3")
        self.tool_requires("cmake/3.24.2")

        self.requires("gmp/6.3.0", override=True)

@AndreyMlashkin
Copy link
Author

conan install . --build missing -g VirtualBuildEnv


======== 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

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux


======== Computing dependency graph ========
gcc/12.2.0: Not found in local cache, looking in remotes...
gcc/12.2.0: Checking remote: conancenter
gcc/12.2.0: Downloaded recipe revision e2965d35782138942e42af8e7da1faf7
mpc/1.2.0: Not found in local cache, looking in remotes...
mpc/1.2.0: Checking remote: conancenter
mpc/1.2.0: Downloaded recipe revision 3eb7f548f869fd782601e22fcf196a8c
Graph root
    conanfile.py (Requirements/None): /conanfile.py
Build requirements
    gcc/12.2.0#e2965d35782138942e42af8e7da1faf7 - Downloaded (conancenter)
    mpc/1.2.0#3eb7f548f869fd782601e22fcf196a8c - Downloaded (conancenter)
ERROR: Version conflict: mpc/1.2.0->gmp/6.3.0, gcc/12.2.0->gmp/6.2.1.

@AndreyMlashkin
Copy link
Author

self.tool_requires("gmp/6.3.0", force=True)

also does not work for conan v2

@memsharded
Copy link
Member

Thanks for the feedback, it seems you are right, there is something there not working as expected, let's investigate it.

@memsharded
Copy link
Member

It seems there is a conflict inside gcc recipe, that is not easy to fix, as transitive dependencies of gcc are hidden (private, visible=False), to the consumers of gcc as tool_requires.

In any case, there is still a transitive dependency of gcc, the isl/0.24, that hasn't been updated yet to Conan 2.0, so it seems this is not going to work atm for 2.0.

I am going to submit a PR with the versions bumps to try to fix it, but without isl/0.24 it might take a bit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants