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

Support the "cohabitation" of several versions of a same package [feature request] #3696

Closed
UnixJunkie opened this issue Dec 11, 2018 · 5 comments

Comments

@UnixJunkie
Copy link
Contributor

This was suggested recently by Emilio Jesús Gallego Arias on caml-list.

I think this feature would significantly boost the reproducibility of opam package installations
over time (which a desirable property).

For example, it would allow two packages that require a different version of a same library dependency
to be satisfied at the same time.

@AltGr
Copy link
Member

AltGr commented Dec 11, 2018

I don't believe any of the OCaml build ecosystem below opam would support that correctly...
Also, we would end up with NPM-like dependency hell when linking: if you have libbar and libbaz depending on respectively libfoo.1 and libfoo.2, then how can you link to both libbar and libbaz at the same time ? You could also need to recompile libbar for every version of libfoo it is compatible with, and keep the separate artefacts for different scenarios.

I am not saying it's not possible, Nix and NPM e.g. work like that, but this seemingly simple feature completely changes the dependency paradigm we work with. This amounts to removing the "switch" abstraction, and delaying actual dependency resolution to build/link time.

The approach we have taken is to keep the "switch" abstraction, which has the advantage of being easier to work with (a single set of "installed" packages), and provide the missing features that this would permit with the addition of:

  • local switches (from opam 2.0)
  • a build cache, so that build artifacts can be reused from one switch to the other, and getting a new switch with different versions can be basically free for what was already compiled (free in compilation time for now, we'll see later for free space-wise). This is being worked on and there are already prototypes, but yet again, relocation is not working out of the box for many of the current opam packages.

This is not the holy grail, and we could still improve to e.g. provide easier access to binaries from different switches, but I believe it is a good compromise to keep everything in control with the tooling we have below opam.

@UnixJunkie
Copy link
Contributor Author

I was also not thinking this is easy.
However, this is quite an interesting feature.

@avsm
Copy link
Member

avsm commented Dec 14, 2018

Can you explain how this feature would provide additional utility vs using the lightweight switches in opam2? Switches permit the simultaneous installation of different version of libraries, and act as a dependency sandbox.

@UnixJunkie
Copy link
Contributor Author

I don't know about lightweight switches.
You can closet this if you feel the feature is already supported in some way.

@dra27
Copy link
Member

dra27 commented Jul 13, 2021

Duplicate of #4054

@dra27 dra27 marked this as a duplicate of #4054 Jul 13, 2021
@dra27 dra27 closed this as completed Jul 13, 2021
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

4 participants