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

[question] transitive tool requirements set on profile file #17413

Open
Alexolut opened this issue Dec 4, 2024 · 3 comments
Open

[question] transitive tool requirements set on profile file #17413

Alexolut opened this issue Dec 4, 2024 · 3 comments
Assignees

Comments

@Alexolut
Copy link

Alexolut commented Dec 4, 2024

My project uses several dependencies that ask for build tools like meson, pkgconf and ninja. I would like to have all these tool packages inside my artifactory repository. I put them as meson/1.4.0@my/stable, pkgconf/2.1.0@my/stable and ninja/1.12.1@my/stable.

I add tools into my conan profile in this way:

[tool_requires]
ninja/1.12.1@my/stable
meson/1.4.0@my/stable
pkgconf/2.1.0@my/stable

But on build stage I got an error:

meson/1.4.0@my/stable: Downloaded recipe revision 0
ERROR: Version range '>=1.10.2 <2' from requirement 'ninja/[>=1.10.2 <2]' required by 'meson/1.4.0@my/stable' could not be resolved in local cache

I even tried to specify dependencies between tools like the following, but with no luck:

[tool_requires]
ninja/1.12.1@my/stable
meson*: ninja/*@my/stable
meson/1.4.0@my/stable
pkgconf*: meson/*@my/stable
pkgconf/2.1.0@my/stable

In the latter case I got this error:

ERROR: Conflict in meson/1.4.0@my/stable:
    'meson/1.4.0@my/stable' requires 'ninja/1.12.1@my/stable' while 'meson/1.4.0@my/stable' requires 'ninja/1.12.1'.
    To fix this conflict you need to override the package 'ninja' in your root package.

How can I fix that issue with dependencies between tools staying entirely inside @my/stable path without editing tools recipes?

I have conan 1.65 only.

@memsharded memsharded self-assigned this Dec 4, 2024
@memsharded
Copy link
Member

Hi @Alexolut

Thanks for your question

meson/1.4.0@my/stable: Downloaded recipe revision 0

This means that you are using Conan 1 with revisions disabled. This would be quite discouraged, revisions have been in Conan 1 for many years, and they are very recommended. Conan 2 uses always revisions enabled.

Then the main problem seem to be:

ninja/[>=1.10.2 <2]

The meson recipe seems to be requiring ninja/[>=1.10.2 <2]. But based on your profile, you might have created ninja/1.12.1@my/stable instead. Those are different packages if using different user/channel. You might need to align both.

Our recommendation is, for ConanCenter-like packages, that is third-parties open-source built from ConanCenter recipes (conan-center-index github repo), the best is to keep them without user/channel. See recommendations in https://docs.conan.io/2/devops/conancenter/hosting_binaries.html

Please try that and let us know if this helps.

@Alexolut
Copy link
Author

Alexolut commented Dec 4, 2024

Thank you for the link to recommended approach. I will definitely try this later, but for now am I understand you correctly, that there is no way to override "ninja" requirements from meson by specifying [tool_requires] in profile file?

Will enabling revisions allow me to achieve what I want without modifying the recipe?

@memsharded
Copy link
Member

The problem is that meson doesn't have a tool_requires to ninja, see https://github.com/conan-io/conan-center-index/blob/addbdbcbb17cfdf542b48c742d720413636d5884/recipes/meson/all/conanfile.py#L29.

This is not great, because ninja might not be strictly necessary for meson, but it is something that the consumer defines. Furthermore, being a requires of a tool_requires, makes it not overrideable with [tool_requires] as it is not a tool-requires per se.

It is possible in Conan 2 to define the [replace_requires] section in the build profile, as it applies to the build context, but this doesn't exist in Conan 1.

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

No branches or pull requests

2 participants