Closed quentinbinotcarrier closed 3 weeks ago
Hi @quentinbinotcarrier
Thanks for your feedback.
There is an existing Conan feature intended for this use case. It works like this:
zlib/system
, boost/system
(or zlib/1.3.1@myyocto
for versioned, or the like) recipes that are wrappers for the yocto installed libraries[replace_requires]
feature in the profile that is used for the yocto build to define which dependencies in the dependency graph will be used, instead of the standard onesWhat you are proposing is equivalent to implement all of that in a single toolchain recipe. But this would be more challenging as tool_requires
cannot influence the dependency graph, they are typically loaded after resolving the normal "requirements" for regular libraries, so it would be too late to change how the dependency graph depends on some packages like zlib. So the viable approach is by providing the information in profiles as the above [replace_requires]
does.
This approach (you can read about replace-requires for example in https://blog.conan.io/2022/01/17/New-conan-release-1-44.html) has several advantages:
pkg/system
recipesSo it is less centralized, but it has more flexibility and power. And it is already available in Conan, so this would be the recommended approach at this moment. As commented above, trying to define it in toolchain recipes would have very big architectural challenges, so I don't think this can be considered at the moment.
Thanks very much for your feedback!
That makes sense, thanks a lot for that quick answer. I am still a little bit concerned using this mechanism since it does not allow proper versioning of that "grouped" replace_requires
so that I can resolve it as a dependency.
Would there be a way to have a centralized / version replace_requires
? Or maybe to have some kind of profile "package" so that we know we would need to update to a newer profile to get the latest lib for exemple?
Would there be a way to have a centralized / version replace_requires? Or maybe to have some kind of profile "package" so that we know we would need to update to a newer profile to get the latest lib for exemple?
Yes, there are a couple of machanisms that this can be done:
[replace_requires]
defined in the default
profile that you are using for a specific yocto toolchain.include(default)
to add the profile you want or by command line composition with --profile=profile_base --profile=profile_special
This way it is relatively easy to have the definitions of the [replace_requires]
for a specific toolchain package in a place, then the possible variations you want to manage will include or compose over this base profile, something like:
[settings]
....
[tool_requires]
my_yocto_toolchain/1.0
[replace_requires]
zlib/*: zlib/1.3.1@myyocto
Thanks a lot for you advices, I should be able to do what I want with those mechanisms.
Context
I am currently developing Conan recipes that package Yocto SDKs (see #7431) as toolchain packages. These Yocto SDKs include a manifest listing the "system libraries" available on the host system (e.g.
openssl
,zlib
,boost
). Managing these libraries is essential for cross-compilation as the set of host libraries can vary between versions. Currently, there is no direct way to configure these libraries in the recipe itself, which would be preferable over managing them separately in both the recipe and the profile.Feature Proposal
This feature proposes adding a new configuration section (e.g.,
system_conf
orplatform_conf
) to toolchain packages, allowing system libraries and their paths to be specified directly within the package. This configuration would work similarly toconf_info
/cpp_info
/provides
, providing a centralized way to list platform or system packages that the host system already provides with versioning information (unlike whatprovides
currently do). Additionally, specifying library paths will enable consumers to link against these libraries effectively.Additional Requirements
The toolchain package should also support compiling for the build machine while keeping the deps-tree to facilitate unit testing, maintaining consistent dependencies while fetching them from Conan Center.
Rationale for the Workflow
Have you read the CONTRIBUTING guide?