conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] Allow requirements in Conan file or profiles to specify component qualifiers

Open System-Arch opened this issue 1 year ago • 1 comments

What is your suggestion?

As with others using custom tool chains and shared runtimes, we face the issue of how to add a dependency on files that are part of a build tool package such as gcc or msvc. We don't want to add tool or related runtime dependencies to individual recipes and thus use the [tool_requires] section of our host profile to specify the compiler (e.g., gcc/12.1.0), however, this does not address our runtime library needs (e.g., for libgcc_s.so or libstdc++.so), which are packaged as part of the the gcc Conan package.

Hence my thought is that the runtime aspects of the gcc package (and other similar packages) could be placed in a separate component from the build-time aspects of the compiler. We could then extend our profile so that it looked something like:

[tool_requires]
gcc/12.1.0
[requires]
gcc/12.1.0 components=gcc_runtime`

An alternative and more compact syntax implying the same result but avoiding duplication might be:

[tool_requires]
gcc/12.1.0 runtime_components=gcc_runtime

Yet another alternative would be to permit a component to be annotated as "runtime" within the producer package itself. Then if a package like gcc is specified as a tool_requires, it could add the relevant components to the "requires" package graph. This approach eliminates the need for the consumer to do anything special to obtain the runtime support libraries.

Thanks for your consideration,

Have you read the CONTRIBUTING guide?

  • [X] I've read the CONTRIBUTING guide

System-Arch avatar Sep 18 '24 20:09 System-Arch

Hi @System-Arch

Thanks for your suggestion.

I'd like to step back a little bit and try to understand the problem and pain being solved. It is more a "build-time" problem that packages being built with that tool_requires are not able to correctly link the necessary libraries?

Or it is more a "runtime" problem in which you would like t have a mechanism to gather all transitive shared libraries, including those inside tool_requires for final deployment of the application outside Conan?

memsharded avatar Sep 24 '24 22:09 memsharded