ocaml-community / utop

Universal toplevel for OCaml
Other
844 stars 112 forks source link

Cannot install using opam or paru #460

Closed TLacault closed 1 year ago

TLacault commented 1 year ago

Can't install using opam install utop on Arch Linux:

~ $ ocaml --version

The OCaml toplevel, version 5.0.0
~ $ opam config report

# opam config report
# opam-version         2.1.5 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=garuda os-version=soaring
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 15
# repositories         1 (http) (default repo at f3720b1c)
# pinned               0
# current-switch       default
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /usr/lib/ocaml/stublibs:/usr/lib/ocaml
# ocaml:preinstalled   true
# ocaml:compiler       system
# ocaml-system:path    /usr/bin
~ $ uname -r

6.4.12-zen1-1-zen
~ $ pacman -Q | awk '/caml/ || /opam/'

ocaml 5.0.0-1
ocaml-compiler-libs 5.0.0-1
opam 2.1.5-1
~ $ opam install utop -vv --debug

00:00.009  CLI                    Parsing CLI version 2.1
00:00.009  GSTATE                 LOAD-GLOBAL-STATE @ /home/tlacault/.opam
00:00.009  RSTATE                 LOAD-REPOSITORY-STATE @ /home/tlacault/.opam
00:00.142  CACHE(repository)      Loaded /home/tlacault/.opam/repo/state-28AC8B61.cache in 0.133s
00:00.142  RSTATE                 Cache found
00:00.142  STATE                  LOAD-SWITCH-STATE @ default
00:00.144  CACHE(installed)       Loaded /home/tlacault/.opam/default/.opam-switch/packages/cache in 0.001s
00:00.200  STATE                  Switch state loaded in 0.058s
00:00.200  FILE(switch-state)     Wrote /home/tlacault/.opam/default/.opam-switch/backup/state-20230905170114.export in 0.000s
00:00.305  CLIENT                 INSTALL utop
+ /usr/bin/lsb_release "-s" "-r"
- Soaring
+ /usr/bin/ocamlc "-vnum"
- 5.0.0
00:00.459  SYSTEM                 mkdir /tmp/opam-29788-45c64c
00:01.006  SYSTEM                 rmdir /tmp/opam-29788-45c64c
00:02.635  XSYS                   Adding to env { LC_ALL=C }
00:03.162  STATE                  depexts loaded in 2.703s
00:03.311  STATE                  ERR: undefined filter variable in dependencies of reason-react.0.11.0: with-dev-setup
00:03.475  STATE                  Detected changed packages (marked for reinstall): {}
00:03.477  CLIENT                 Base orphans: {}
00:03.491  CLIENT                 Orphans: (changes: { utop.1.2.1, utop.1.3.0, utop.1.4.0, utop.1.5, utop.1.6, utop.1.7, utop.1.8, utop.1.9, utop.1.10, utop.1.11, utop.1.12, utop.1.14, utop.1.15, utop.1.16, utop.1.17, utop.1.18, utop.1.18.1, utop.1.18.2, utop.1.19, utop.1.19.1, utop.1.19.2, utop.1.19.3, utop.2.0.0, utop.2.0.1, utop.2.0.2, utop.2.1.0, utop.2.2.0, utop.2.3.0, utop.2.4.0, utop.2.4.1, utop.2.4.2, utop.2.4.3, utop.2.5.0, utop.2.6.0, utop.2.7.0, utop.2.8.0, utop.2.9.0, utop.2.9.1, utop.2.9.2, utop.2.10.0, utop.2.11.0, utop.2.12.0, utop.2.12.1, utop.2.13.0, utop.2.13.1 }, transitive: false) -> full {}, versions {}
00:03.660  STATE                  ERR: undefined filter variable in dependencies of reason-react.0.11.0: with-dev-setup
00:04.030  SOLVER                 resolve request=install:(utop) remove:() upgrade:()
00:05.892  SOLVER                 Load cudf universe (depopts:false, build:true, post:true)
00:06.005  CUDF                   resolve request=install:(utop) remove:() upgrade:()
00:09.891  CUDF                   Conflicts: 34 (0) pkgs to remove
00:09.892  CUDF                   Preprocess cudf request (trimming: full): from 28182 to 1948 packages in 0.39s
00:09.892  SOLVER                 Calling solver builtin-mccs+glpk with criteria -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
00:13.174  CUDF                   Solver call done in 3.677s
00:13.195  SOLVER                 Load cudf universe (depopts:true, build:false, post:false)
00:13.338  SOLVER                 Load cudf universe (depopts:true, build:true, post:false)
00:13.496  SOLUTION               apply
The following actions will be performed:
  ∗ install utop 2.13.1
00:13.505  SOLUTION               parallel_apply

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
00:13.507  PARALLEL               Iterate over 3 task(s) with 15 process(es)
00:13.507  PARALLEL               Starting job 562458211 (worker -/15 -/1 1/3): ⬇ utop.2.13.1
00:13.507  SOLUTION               Fetching sources for utop.2.13.1
00:13.507  ACTION                 download_package: utop.2.13.1
00:13.507  SYSTEM                 rmdir /home/tlacault/.opam/default/.opam-switch/sources/utop.2.13.1
+ /usr/bin/openssl "sha256" "/home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd"
- SHA2-256(/home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd)= b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd
+ /usr/bin/openssl "sha512" "/home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd"
- SHA2-512(/home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd)= 37b116f408a8d8448e5faf99805e3c26a8bc0c149a64e2be75d261b1de9aca176982e95fb0d128e5072f22da99375d0691d23093d4b21d5fb9a26b034c262c51
00:13.522  FILENAME               cleandir /home/tlacault/.opam/default/.opam-switch/sources/utop.2.13.1
00:13.522  SYSTEM                 mkdir /home/tlacault/.opam/default/.opam-switch/sources/utop.2.13.1
00:13.522  SYSTEM                 mkdir /tmp/opam-29788-b102c4
00:13.522  PARALLEL               Next task in job 562458211: /usr/bin/tar xfj /home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd -C /tmp/opam-29788-b102c4
Processing  1/3:
+ /usr/bin/tar "xfj" "/home/tlacault/.opam/download-cache/sha256/b0/b04ec2a394d1a6a28a79444c58f66eab77b7f74401f4714aa6e6f1c2125a6ffd" "-C" "/tmp/opam-29788-b102c4"
00:13.551  PARALLEL               Collected task for job 562458211 (ret:0)
00:13.558  SYSTEM                 rmdir /tmp/opam-29788-b102c4
⬇ retrieved utop.2.13.1  (cached)
00:13.562  PARALLEL               Job 562458211 finished
00:13.562  PARALLEL               Starting job 98050936 (worker 1/15 -/1 -/3): λ utop.2.13.1
00:13.562  SYSTEM                 rmdir /home/tlacault/.opam/default/.opam-switch/build/utop.2.13.1
00:13.582  ACTION                 prepare_package_source: utop.2.13.1 at /home/tlacault/.opam/default/.opam-switch/build/utop.2.13.1
00:13.582  SYSTEM                 mkdir /tmp/opam-29788-b89dde
+ /usr/bin/tar "xfz" "/home/tlacault/.opam/repo/default.tar.gz" "-C" "/tmp/opam-29788-b89dde"
00:14.156  PARALLEL               Next task in job 98050936: /home/tlacault/.opam/opam-init/hooks/sandbox.sh build dune build -p utop -j 15 @install
Processing  2/3: [utop: dune build]
+ /home/tlacault/.opam/opam-init/hooks/sandbox.sh "build" "dune" "build" "-p" "utop" "-j" "15" "@install" (CWD=/home/tlacault/.opam/default/.opam-switch/build/utop.2.13.1)
- (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I src/lib/.uTop.objs/byte -I /home/tlacault/.opam/default/lib/bytes -I /home/tlacault/.opam/default/lib/findlib -I /home/tlacault/.opam/default/lib/lambda-term -I /home/tlacault/.opam/default/lib/logs -I /home/tlacault/.opam/default/lib/lwt -I /home/tlacault/.opam/default/lib/lwt/unix -I /home/tlacault/.opam/default/lib/lwt_react -I /home/tlacault/.opam/default/lib/mew -I /home/tlacault/.opam/default/lib/mew_vi -I /home/tlacault/.opam/default/lib/ocplib-endian -I /home/tlacault/.opam/default/lib/ocplib-endian/bigstring -I /home/tlacault/.opam/default/lib/react -I /home/tlacault/.opam/default/lib/result -I /home/tlacault/.opam/default/lib/trie -I /home/tlacault/.opam/default/lib/uchar -I /home/tlacault/.opam/default/lib/uucp -I /home/tlacault/.opam/default/lib/uuseg -I /home/tlacault/.opam/default/lib/uutf -I /home/tlacault/.opam/default/lib/zed -I /usr/lib/ocaml/compiler-libs -I /usr/lib/ocaml/threads -I /usr/lib/ocaml/unix -I /usr/lib/ocaml/xdg -no-alias-deps -o src/lib/.uTop.objs/byte/uTop_private.cmo -c -impl src/lib/uTop_private.pp.ml)
- File "src/lib/uTop_private.ml", line 25, characters 17-30:
- Error: Unbound value Xdg.state_dir
- Hint: Did you mean data_dir?
00:14.788  PARALLEL               Collected task for job 98050936 (ret:1)
[ERROR] The compilation of utop.2.13.1 failed at "dune build -p utop -j 15 @install".
00:14.788  PARALLEL               Job 98050936 finished
00:14.788  PARALLEL               Starting job 10629180 (worker -/15 1/1 -/3): ∗ utop.2.13.1
00:14.789  PARALLEL               Job 10629180 finished

#=== ERROR while compiling utop.2.13.1 ========================================#
# context     2.1.5 | linux/x86_64 | ocaml.5.0.0 | https://opam.ocaml.org#f3720b1c
# path        ~/.opam/default/.opam-switch/build/utop.2.13.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p utop -j 15 @install
# exit-code   1
# env-file    ~/.opam/log/utop-29788-25928d.env
# output-file ~/.opam/log/utop-29788-25928d.out
### output ###
# (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I src/lib/.uTop.objs/byte -I /home/tlacault/.opam/default/lib/bytes -I /home/tlacault/.opam/default/lib/findlib -I /home/tlacault/.opam/default/lib/lambda-term -I /home/tlacault/.opam/default/lib/logs -I /home/tlacault/.opam/default/lib/lwt -I /home/tlacault/.opam/default/lib/lwt/unix -I /home/tlacault/.opam/default/lib/lwt_react[...]
# File "src/lib/uTop_private.ml", line 25, characters 17-30:
# Error: Unbound value Xdg.state_dir
# Hint: Did you mean data_dir?

00:14.789  CACHE(installed)       Writing the installed cache to ~/.opam/default/.opam-switch/packages/cache ...
00:14.789  CACHE(installed)       ~/.opam/default/.opam-switch/packages/cache written in 0.000s

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build utop 2.13.1
└─ 
╶─ No changes have been performed
00:14.790  ENV                    Not up-to-date env variables: [PATH MANPATH OCAML_TOPLEVEL_PATH CAML_LD_LIBRARY_PATH CAML_LD_LIBRARY_PATH OPAM_SWITCH_PREFIX]
# Run eval $(opam env) to update the current shell environment
00:14.790  SYSTEM                 rm /home/tlacault/.opam/default/.opam-switch/backup/state-20230905170114.export
00:14.790  SYSTEM                 rmdir /tmp/opam-29788-b89dde/default
00:15.333  SYSTEM                 rmdir /tmp/opam-29788-b89dde
'opam install utop -vv --debug' failed.
~ $ opam list

# Packages matching: installed
# Name            # Installed # Synopsis
base              v0.16.3     Full standard library replacement for OCaml
base-bigarray     base
base-bytes        base        Bytes library distributed with the OCaml compiler
base-domains      base
base-nnp          base        Naked pointers prohibited in the OCaml heap
base-threads      base
base-unix         base
cppo              1.6.9       Code preprocessor like cpp for OCaml
csexp             1.5.2       Parsing and printing of S-expressions in Canonical form
dune              3.10.0      Fast, portable, and opinionated build system
dune-configurator 3.10.0      Helper library for gathering system configuration
lambda-term       3.3.2       Terminal manipulation library for OCaml
logs              0.7.0       Logging infrastructure for OCaml
lwt               5.7.0       Promises and event-driven I/O
lwt_react         1.2.0       Helpers for using React with Lwt
mew               0.1.0       Modal editing witch
mew_vi            0.5.0       Modal editing witch, VI interpreter
ocaml             5.0.0       The OCaml compiler (virtual package)
ocaml-config      3           OCaml Switch Configuration
ocaml-system      5.0.0       The OCaml compiler (system version, from outside of opam)
ocamlbuild        0.14.2      OCamlbuild is a build system with builtin rules to easily build most OCaml projects
ocamlfind         1.9.6       A library manager for OCaml
ocplib-endian     1.2         Optimised functions to read and write int16/32/64 from strings and bigarrays
react             1.2.2       Declarative events and signals for OCaml
result            1.5         Compatibility Result module
sexplib0          v0.16.0     Library containing the definition of S-expressions and some base converters
stdio             v0.16.0     Standard IO library for OCaml
topkg             1.0.7       The transitory OCaml software packager
trie              1.0.0       Strict impure trie tree
uchar             0.0.2       Compatibility library for OCaml's Uchar module
uucp              15.0.0      Unicode character properties for OCaml
uuseg             15.0.0      Unicode text segmentation for OCaml
uutf              1.0.3       Non-blocking streaming Unicode codec for OCaml
xdg               3.10.0      XDG Base Directory Specification
zed               3.2.1       Abstract engine for text edition in OCaml

Can't install using paru -u ocaml-utop :

~ $ paru -u ocaml-utop

1 aur/ocaml-utop 2.12.1-2 [+11 ~0.02]
    Universal toplevel for OCaml
:: Packages to install (eg: 1 2 3, 1-3):
:: 1
[sudo] password for tlacault:                        
:: Starting full system upgrade...
 there is nothing to do
:: Looking for AUR upgrades...
:: Looking for devel upgrades...
:: Resolving dependencies...
error: could not find all required packages:
    ocaml-base>=0.16.0 (wanted by: ocaml-utop -> ocaml-lambda-term -> ocaml-logs -> ocaml-js_of_ocaml -> ocaml-lwt -> ocaml-ppx_let)
    ocaml-stdio>=0.16.0 (wanted by: ocaml-utop -> ocaml-lambda-term -> ocaml-logs -> ocaml-js_of_ocaml -> ocaml-sedlex -> ocaml-ppx_expect -> ocaml-ppx_inline_test -> ocaml-time_now -> ocaml-ppx_optcomp)
emillon commented 1 year ago

The issue here is that utop requires xdg >= 3.9.0. The one installed in your switch fits, but for some reason you have a system-wide xdg library that takes precedence. One cause of this is that you're using a "system" switch with ocaml installed in /usr/bin. Using a non-system opam switch (created with opam switch create ...) should work. I'm not sure if this is supposed to work with a system switch.

emillon commented 1 year ago

(I'll ask the opam team their opinion ; potentially that's also an issue with how your distribution packages things)

TLacault commented 1 year ago

Creating a switch with ocaml-base-compiler v4.14.1 solved the issue.

before creating the switch :

~ $ opam switch list

#  switch   compiler                    description
→  default  ocaml.5.0.0                 default
~ $ opam switch create 4.14.1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "4.14.1"} | "ocaml-system" {= "4.14.1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-options-vanilla.1
⬇ retrieved ocaml-base-compiler.4.14.1  (https://opam.ocaml.org/cache)
∗ installed ocaml-base-compiler.4.14.1
∗ installed ocaml-config.2
∗ installed ocaml.4.14.1
Done.
~ $ opam switch

#  switch   compiler                    description
→  4.14.1   ocaml-base-compiler.4.14.1  4.14.1
   default  ocaml.5.0.0                 default

and finally :

~ $ opam install utop

The following actions will be performed:
  ∗ install dune              3.10.0 [required by utop]
  ∗ install ocamlfind         1.9.6  [required by utop]
  ∗ install ocamlbuild        0.14.2 [required by logs]
  ∗ install xdg               3.10.0 [required by utop]
  ∗ install trie              1.0.0  [required by mew]
  ∗ install result            1.5    [required by zed]
  ∗ install csexp             1.5.2  [required by dune-configurator]
  ∗ install cppo              1.6.9  [required by utop]
  ∗ install base-bytes        base   [required by ocplib-endian]
  ∗ install uchar             0.0.2  [required by zed]
  ∗ install topkg             1.0.7  [required by logs]
  ∗ install mew               0.1.0  [required by mew_vi]
  ∗ install dune-configurator 3.10.0 [required by lwt]
  ∗ install ocplib-endian     1.2    [required by lwt]
  ∗ install uutf              1.0.3  [required by zed]
  ∗ install react             1.2.2  [required by utop]
  ∗ install lwt               5.7.0  [required by utop]
  ∗ install uucp              15.0.0 [required by zed]
  ∗ install mew_vi            0.5.0  [required by lambda-term]
  ∗ install lwt_react         1.2.0  [required by utop]
  ∗ install logs              0.7.0  [required by utop]
  ∗ install uuseg             15.0.0 [required by zed]
  ∗ install zed               3.2.3  [required by utop]
  ∗ install lambda-term       3.3.2  [required by utop]
  ∗ install utop              2.13.1
===== ∗ 25 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved cppo.1.6.9  (cached)
⬇ retrieved csexp.1.5.2  (cached)
⬇ retrieved lambda-term.3.3.2  (cached)
⬇ retrieved logs.0.7.0  (cached)
⬇ retrieved lwt.5.7.0  (cached)
⬇ retrieved lwt_react.1.2.0  (cached)
⬇ retrieved mew.0.1.0  (cached)
⬇ retrieved mew_vi.0.5.0  (cached)
⬇ retrieved ocamlbuild.0.14.2  (cached)
⬇ retrieved dune.3.10.0  (cached)
⬇ retrieved dune-configurator.3.10.0  (cached)
⬇ retrieved ocamlfind.1.9.6  (cached)
⬇ retrieved ocplib-endian.1.2  (cached)
⬇ retrieved react.1.2.2  (cached)
⬇ retrieved result.1.5  (cached)
⬇ retrieved trie.1.0.0  (cached)
⬇ retrieved topkg.1.0.7  (cached)
⬇ retrieved uchar.0.0.2  (cached)
⬇ retrieved utop.2.13.1  (cached)
⬇ retrieved uuseg.15.0.0  (cached)
⬇ retrieved uutf.1.0.3  (cached)
⬇ retrieved zed.3.2.3  (cached)
⬇ retrieved uucp.15.0.0  (cached)
⬇ retrieved xdg.3.10.0  (cached)
∗ installed ocamlfind.1.9.6
∗ installed base-bytes.base
∗ installed ocamlbuild.0.14.2
∗ installed uchar.0.0.2
∗ installed topkg.1.0.7
∗ installed uutf.1.0.3
∗ installed react.1.2.2
∗ installed dune.3.10.0
∗ installed csexp.1.5.2
∗ installed cppo.1.6.9
∗ installed result.1.5
∗ installed trie.1.0.0
∗ installed mew.0.1.0
∗ installed ocplib-endian.1.2
∗ installed xdg.3.10.0
∗ installed mew_vi.0.5.0
∗ installed dune-configurator.3.10.0
∗ installed lwt.5.7.0
∗ installed lwt_react.1.2.0
∗ installed logs.0.7.0
∗ installed uucp.15.0.0
∗ installed uuseg.15.0.0
∗ installed zed.3.2.3
∗ installed lambda-term.3.3.2
∗ installed utop.2.13.1
Done.