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

"No agreement on the version of ocaml" while opam file seems fine #5427

Closed
MdeLv opened this issue Jan 24, 2023 · 7 comments
Closed

"No agreement on the version of ocaml" while opam file seems fine #5427

MdeLv opened this issue Jan 24, 2023 · 7 comments

Comments

@MdeLv
Copy link

MdeLv commented Jan 24, 2023

opam install seems to tell the contrary of what is stated in the opam file. How is it possible?

See example: OCamlPro/ocaml-top#76 where we have ocaml.4.02.0 or newer required and opam says "- ocaml-top → ocaml < 4.02.4":

$ cat ocaml-top.opam
depends      "ocaml" {>= "4.02.0"}

and

$ opam install ocaml-top
[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml-base-compiler = 4.14.0 → ocaml = 4.14.0
    - ocaml-top → ocaml < 4.02.4
    >>> You can temporarily relax the switch invariant with `--update-invariant'   <<<
  * No agreement on the version of ocaml-base-compiler:
    - (invariant) → ocaml-base-compiler = 4.14.0
    - ocaml-top → ocaml < 4.02.4 → ocaml-base-compiler < 3.07+1
  * Missing dependency:
    - ocaml-top → ocp-build < 1.99.8-beta
    no matching version
  * Missing dependency:
    - ocaml-top → ocaml < 4.02.4 → ocaml-variants → ocaml-beta
    unmet availability conditions: 'enable-ocaml-beta-repository'

No solution found, exiting

@kit-ty-kate
Copy link
Member

which version of opam do you have?

@kit-ty-kate
Copy link
Member

With the opam 2.1.4 i get:

[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) -> ocaml-base-compiler = 4.14.1 -> ocaml = 4.14.1
    - ocaml-top >= 1.2.0 -> ocp-pp -> ocaml < 4.11
    You can temporarily relax the switch invariant with `--update-invariant'
  * No agreement on the version of ocaml-base-compiler:
    - (invariant) -> ocaml-base-compiler = 4.14.1
    - ocaml-top >= 1.2.0 -> ocp-pp -> ocaml < 4.11 -> ocaml-base-compiler = 4.07.0
  * Missing dependency:
    - ocaml-top >= 1.2.0 -> ocp-pp -> typerex-build -> ocaml < 4.05.0 -> ocaml-variants >= 4.02.3 ->
      ocaml-beta
    unmet availability conditions: 'enable-ocaml-beta-repository'

No solution found, exiting

which, while not being the most concise (see #4373) is at least correct.

@MdeLv
Copy link
Author

MdeLv commented Jan 25, 2023

$ opam --version
2.1.4

This kind of opam message is neither concise nor immediately understandable.
How can you explain (4.14.0, my example) - ocaml-top → ocaml < 4.02.4 → ocaml-base-compiler < 3.07+1 while the opam file says ocaml-version >= "4.02.0"?

ocaml-top.opam (1.1.5)

opam-version: "1.2"
version: "1.1.5"
maintainer: "[email protected]"
tags: [ "org:ocamlpro" "gui" "teaching" "toplevel" ]
authors: "Louis Gesbert <[email protected]>"
homepage: "http://www.typerex.org/ocaml-top.html"
dev-repo: "https://github.com/OCamlPro/ocaml-top.git"
bug-reports: "https://github.com/OCamlPro/ocaml-top/issues"
license: "GPL-3"
available: [ ocaml-version >= "4.02.0" ]
build: ["jbuilder" "build" "-p" name]
depends: [
  "jbuilder"
  "ocp-pp"
  "lablgtk" {>= "2.16.0"}
  "conf-gtksourceview" {= "2"}
  "ocp-indent" {>= "1.4.0"}
  "ocp-index" {>= "1.0.0"}
]

I feel and think that the opam file is WRONG and MISLEADING.
It claims or at least suggests that "ocaml 4.02.0 or newer is required", which is the main question we ask ourselves when installing a package.

It also means that packages.opam.org (and opam) accepts WRONG and MISLEADING packages regarding ocaml version. At least one, but I have memories of other packages.

What do you think about the following proposition?

Proposition:
Enforce opam files (hence hinder their authors) to mention an explicit range (>= and <=) for ocaml version as prerequisite that guarantees it can be installed if this range is respected.
Example:
Dependencies ocaml >=4.03.0 <=4.07.1
(yes, ">= and <=" and NOT "> and <" or ">= and <")

PS: where is the specification of opam?
of opam.ocaml.org/packages/?

@rjbou
Copy link
Collaborator

rjbou commented Jan 25, 2023

Please keep discussions polite. If you feel that ocaml-top opam file is not correct, please help fixing it by opening a PR in its own repository. If you want to discuss, or better help improve opam repository and its policy, please help in their repository, there is also several discussions on ocaml forum concerning opam repository. This bug tracker is only for opam issues, not ecosystem or package issues.

So, on opam itself, when no solution is found, opam tries to rollback to find a reason for no solution to the request. What happened in your case is that you didn't try to install a specific version of ocaml-top, but asked a version to be installed. And one choosen path by opam was ocaml-top version 1.1.2 or 1.1.3 that have the constraint ocaml <= 4.02.3. That's why opam prints that error message, and why it doesn't fit ocaml-top.1.1.5 opam file.
If you specify the version, you get another message

$ opam install ocaml-top.1.1.5
[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml = 4.14.0
    - ocaml-top >= 1.1.5 → ocp-pp → ocaml < 4.11
    You can temporarily relax the switch invariant with `--update-invariant'

No solution found, exiting

Opam should take the path of the latest version when it's possible, there is an issue tracking this problem: #4373 (reproduced here: #5130 (comment)).

Closing this issue as duplicate.

You can find opam files specification in opam manual.

@rjbou rjbou closed this as completed Jan 25, 2023
@MdeLv
Copy link
Author

MdeLv commented Jan 25, 2023

1/ We are talking about facts. What is not polite?

2/ It looks like opam, then packages.opam.org can accept WRONG and/or MISLEADING opam files and let packages be published. I don't understand how the CI process can accept that. Can you ?
Should the author be authorized to publish a package that can't be installed? (in that case it's a package for education that should be delivered out of the box, if you don't want newcomers to run away from OCaml at first contact...)

3/ I think that it IS an opam issue not to enforce a clear ocaml version range, which is the main criterion when installing a package on a current OCaml configuration (system-wide or possibly in a so-called OCaml "switch"). And it must be mandatory for any package author/publisher.
https://opam.ocaml.org/doc/Manual.html#opam has a bunch of specifications but it seems it doesn't address that simple and key requirement (ocaml version range). Isn't it ?

@rjbou
Copy link
Collaborator

rjbou commented Jan 26, 2023

1/ It's possible to talk about facts and be polite, it's completely 2 different things. It's always better to ask to involved people about how project/community works, how it is managed, etc. before openly and loudly criticising other people work.

2-3/ As said in previous answer, this is not an opam issue. Maybe there was a misunderstanding. Opam (this repository) is the tool, the package manager. It is the opam repository who is in charge of managing the opam repository, in which maintainer publish their packages, in which contribution follow guidelines, etc. And opam.ocaml.org is just a website that contains opam manual/documentation, and opam repository package information. These are 3 distinct repositories and projects.
Opam the tool just apply what is in the given opam file, following its format/specification. It is not even aware that it is an OCaml compiler.

@MdeLv
Copy link
Author

MdeLv commented Mar 2, 2023

We are very polite, aren't we?

Do you think that the tool (opam) can let people write a wrong .opam file?
I've already seen an incorrect .opam file which turns a good software into a uselessly bad experience.

For a published package, who is responsible for:
1/ enforcing
2/ checking
that an .opam file is correct regarding a range of dependencies' versions?

The expected result is:
1/ I find a nice package
2/ I check its OCaml compiler compatible versions (regarding the usual other packages I'm using)
3/ I just have to install it on any compiler claimed as compatible: It will be straight-fully and correctly installed with ALL dependencies handled WITHOUT any cryptic or disappointing message.

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

3 participants