-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Problem you are trying to solve
One specificity of cg_gcc distribution is the component structure:
let's say that we are on x64 [host]. if you want to compile x64 -> x64, rustc (and then transitively cg_gcc) will load:
/lib/rustlib/x64/codegen-backends/cg_gcc.so
/lib/rustlib/x64/codegen-backends/lib/x64/libgccjit.so
if you want to compile x64 -> aarch64, it will load/lib/rustlib/x64/codegen-backends/cg_gcc.so
/lib/rustlib/x64/codegen-backends/lib/aarch64/libgccjit.so
(note the path to cg_gcc.so stays the same in both situations)
@Kobzol in #t-rustup > Adding support for more target-specific components @ 💬
The thing is that if we want to install rustup component add cg-gcc-x64 cg-gcc-aarch64 as-is today, the two will clash with each other WRT <root>/lib/rustlib/x64/codegen-backends/cg_gcc.so.
Solution you'd like
Assume that logically there are 3 artifacts to be installed. Let's call them a) cg-gcc-so, b) cg-gcc-libgccjit-x64 and c) cg-gcc-libgccjit-aarch64 (these are not real component names, just to show the idea; the real name of those artifacts will always be suffixed by the host tuple in addition).
I see several possible solutions here:
-
Introduce the notion of refcounted artifacts. In this interpretation,
cg-gcc-x64is a component that includes a) and b), andcg-gcc-aarch64a) and c), i.e. both components share the artifact a).- When installing a component, we skip the artifacts that are already installed, but increment the refcounts of the latter (on disk?) at the same time.
- When uninstalling a component, we decrement the refcounts of any artifact it has with a refcount >1, or remove the artifact directly otherwise.
-
Introduce the notion of component groups. In this interpretation, each of the 3 artifacts is a component in itself, so
cg-gcc-x64is a group that includes a) and b), andcg-gcc-aarch64a) and c), i.e. both groups share the component a).- When installing a group, we skip the components that are already installed.
- What it means to uninstall a group remains unclear since we must decide what to do with a). We can ignore implementing this altogether at the first step.
-
Introduce the notion of dependencies like traditional package managers (this could be abused to become a nightmare later on though). In this interpretation, each of the 3 artifacts is a component in itself, and b) and c) depend on a).
- When installing a component that has dependencies, we skip the dependencies that are already installed.
- When uninstalling a component that has dependencies, only that specific component is removed. Recursive uninstallation can be implemented later.
Notes
No response