How can I ask Opam to compile a package that compiles manually with make but does not with the current opam file ?
I would like to use cpdf 2.2.1 while I’m using Ocaml 4.07.1
$ opam install cpdf
The following dependencies couldn't be met:
- cpdf → camlpdf < 2.1 → ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
- cpdf → ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
camlpdf.2.2.1 can be installed on a 4.07.1 switch.
I’ve tried --unlock-base and got that message from opam:
$ opam install --unlock-base cpdf
[ERROR] Sorry, resolution of the request timed out.
Try to specify a simpler request, use a different solver, or increase the allowed time by setting OPAMSOLVERTIMEOUT to a
bigger value (currently, it is set to 60.0 seconds).
I didn’t change the value of the variable OPAMSOLVERTIMEOUT before asking this question.
The author of the package says that it’s possible to manually install camlpdf and cpdf (2.2.1) from source with Ocaml 4.07.1:
$ make install # for camlpdf
$ make # for cpdf
# with the same version for both (2.2.1)
Hence the question: how can I ask Opam to install cpdf.2.2.1 with OCaml 4.07.1?
Should I modify the local opam file?
Thanks
Thanks.
I tried to do opam pin add git+https://github.com/johnwhitington/cpdf-source.git#2.3
But I got an error message:
[ERROR] Could not synchronize ~/.opam/4.07.1_ocsigen/.opam-switch/sources/cpdf from
"git+https://github.com/johnwhitington/cpdf-source.git#2.3":
"/usr/bin/git fetch -q https://github.com/johnwhitington/cpdf-source.git +2.3:refs/remotes/opam-ref-2.3" exited with code
128 "fatal: Couldn't find remote ref 2.3"
[ERROR] Error getting source from git+https://github.com/johnwhitington/cpdf-source.git#2.3:
- git+https://github.com/johnwhitington/cpdf-source.git#2.3
Then with #v2.3, but it pins 2.2.1:
$ opam pin add cpdf https://github.com/johnwhitington/cpdf-source.git#v2.3
[cpdf.2.2.1] synchronised from git+https://github.com/johnwhitington/cpdf-source.git#v2.3
cpdf is now pinned to git+https://github.com/johnwhitington/cpdf-source.git#v2.3 (version 2.2.1)
The following dependencies couldn't be met:
- cpdf → ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
[NOTE] Pinning command successful, but your installed packages may be out of sync.
Which path is it supposed to be to get cpdf.2.3?
I didn’t find the --edit option in the opam install section. I saw --ignore-constraints-on.
That is surprising. It should ask you to overwrite the opam file using the new one. We mergend cpdf 2.3 and there is a PR to relax cpdf 2.2.1 bounds. You can modify the local opam file, or opam update and then install the new cpdf
@Luc_ML
The edit option is available for opam pin command, used directly opam pin edit cpdf or used as an argument opam pin --edit cpdf <url> (cf. manpage).
The repo url format is described here, the # is a separator to specify a branche, tag or hash. As git reference 2.3 don’t exist on cpdf repo, it can’t succeed, but tag v2.3 exists and it is retrieved then.
opam tries to find by different means an opam file to follow. As cpdf repo doesn’t contain one, and no version is specified on cli, it takes as opam file for pinning the last one in the repository, i.e. 2.2.1 one.
But as said @mseri, the easiest solution for you, is to update opam repositories (opam update) and reinstall cpdf (2.3 is on opam repo & no more have the ocaml.4.06.0 constraint).
I could do opam update && opam upgrade && opam install cpdf .
In fact, I searched in opam install --help (and opam --help ), thinking all commands were shown there.
But it’s specifically located in opam pin --help (or opam pin edit --help )
Thanks for your explanation.
EDIT
I’ve been trapped with “silently” (forgotten) pinned packages:
cpdf was pinned to git+https://github.com/johnwhitington/cpdf-source.git#v2.3 but this is not visible with opam list
another package that I could hardly notice because version is in blue instead of purple (may be light blue background could be more visible?)
What about modifying the opam list command so:
1/ it indicates the switch name in a header
2/ it produces the details of pinned packages in a footer opam list could be an alias for:
header: opam switch show
body: opam list
footer: opam pin list
This is what I quickly set up: alias 'opaml'='opam switch show && opam list && opam list --pinned'
Now I know, but this could be helpful for beginners (Ocaml, Emacs/Vim, Merlin, Opam, Dune… : that’s a lot of stuff to handle at the same time).