I havenβt used OCaml or OPAM in a couple months, and in the intervening time, I upgraded Ubuntu 22.04 to 24.04. Not sure if that matters, but thought you should know.
Anyway I tried to install the server for VSCoq today and got lots of errors.
An example:
$ opam pin add coq 8.18.0
[misc messages]
[ERROR] The compilation of ocaml.4.11.2 failed at "ocaml /home/ninjaaron/.opam/4.11.2+flambda/share/ocaml-config/gen_ocaml_config.ml 4.11.2 ocaml".
#=== ERROR while compiling ocaml.4.11.2 =======================================#
# context 2.2.1 | linux/x86_64 | ocaml-variants.4.11.2+flambda | https://opam.ocaml.org#08323f3c377fcf2b812d13ae4c3581a6f29f3e59
# path ~/.opam/4.11.2+flambda/.opam-switch/build/ocaml.4.11.2
# command ~/.opam/opam-init/hooks/sandbox.sh build ocaml /home/ninjaaron/.opam/4.11.2+flambda/share/ocaml-config/gen_ocaml_config.ml 4.11.2 ocaml
# exit-code 1
# env-file ~/.opam/log/ocaml-38724-f8e142.env
# output-file ~/.opam/log/ocaml-38724-f8e142.out
### output ###
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
#=== ERROR while compiling conf-pkg-config.3 ==================================#
# context 2.2.1 | linux/x86_64 | ocaml-variants.4.11.2+flambda | https://opam.ocaml.org#08323f3c377fcf2b812d13ae4c3581a6f29f3e59
# path ~/.opam/4.11.2+flambda/.opam-switch/build/conf-pkg-config.3
# command ~/.opam/opam-init/hooks/sandbox.sh build pkg-config --help
# exit-code 1
# env-file ~/.opam/log/conf-pkg-config-38724-e254a6.env
# output-file ~/.opam/log/conf-pkg-config-38724-e254a6.out
### output ###
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
#=== ERROR while compiling conf-gmp.4 =========================================#
# context 2.2.1 | linux/x86_64 | ocaml-variants.4.11.2+flambda | https://opam.ocaml.org#08323f3c377fcf2b812d13ae4c3581a6f29f3e59
# path ~/.opam/4.11.2+flambda/.opam-switch/build/conf-gmp.4
# command ~/.opam/opam-init/hooks/sandbox.sh build sh -exc cc -c $CFLAGS -I/usr/local/include test.c
# exit-code 1
# env-file ~/.opam/log/conf-gmp-38724-da4620.env
# output-file ~/.opam/log/conf-gmp-38724-da4620.out
### output ###
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
ββ The following actions failed
β Ξ» build conf-gmp 4
β Ξ» build conf-pkg-config 3
β Ξ» build ocaml 4.11.2
ββ
ββ The following changes have been performed (the rest was aborted)
β β remove ocaml 4.11.2
β β» recompile ocaml-config 1
ββ
# Run eval $(opam env) to update the current shell environment
[NOTE] Pinning command successful, but your installed packages may be out of sync.
The former state can be restored with:
/usr/local/bin/opam switch import "/home/ninjaaron/.opam/4.11.2+flambda/.opam-switch/backup/state-20241105083416.export"
Didnβt feel great about that. Tried upgrading all my packages.
$ opam update
[exits without error]
$ opam upgrade
[truncated]
#=== ERROR while compiling ocaml-base-compiler.5.1.0 ==========================#
# context 2.2.1 | linux/x86_64 | | https://opam.ocaml.org#08323f3c377fcf2b812d13ae4c3581a6f29f3e59
# path ~/.opam/5.1.0/.opam-switch/build/ocaml-base-compiler.5.1.0
# command ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/home/ninjaaron/.opam/5.1.0 --docdir=/home/ninjaaron/.opam/5.1.0/doc/ocaml -C
# exit-code 1
# env-file ~/.opam/log/ocaml-base-compiler-41587-95f2fc.env
# output-file ~/.opam/log/ocaml-base-compiler-41587-95f2fc.out
### output ###
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
ββ The following actions failed
β Ξ» build ocaml-base-compiler 5.1.0
ββ
βΆβ No changes have been performed
Donβt like that much either. Tried building the latest switch, since rebuilding my current compiler seems to be a no-go.
$ opam switch create 5.2.0
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "5.2.0"} | "ocaml-system" {= "5.2.0"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
β¬ retrieved ocaml-config.3 (cached)
β installed base-bigarray.base
β installed base-threads.base
β installed base-unix.base
β installed host-arch-x86_64.1
β installed host-system-other.1
β installed ocaml-options-vanilla.1
β¬ retrieved ocaml-base-compiler.5.2.0 (cached)
[ERROR] The compilation of ocaml-base-compiler.5.2.0 failed at "./configure --prefix=/home/ninjaaron/.opam/5.2.0 --docdir=/home/ninjaaron/.opam/5.2.0/doc/ocaml -C".
#=== ERROR while compiling ocaml-base-compiler.5.2.0 ==========================#
# context 2.2.1 | linux/x86_64 | | https://opam.ocaml.org#08323f3c377fcf2b812d13ae4c3581a6f29f3e59
# path ~/.opam/5.2.0/.opam-switch/build/ocaml-base-compiler.5.2.0
# command ~/.opam/opam-init/hooks/sandbox.sh build ./configure --prefix=/home/ninjaaron/.opam/5.2.0 --docdir=/home/ninjaaron/.opam/5.2.0/doc/ocaml -C
# exit-code 1
# env-file ~/.opam/log/ocaml-base-compiler-43790-7416e1.env
# output-file ~/.opam/log/ocaml-base-compiler-43790-7416e1.out
### output ###
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
ββ The following actions failed
β Ξ» build ocaml-base-compiler 5.2.0
ββ
ββ The following changes have been performed (the rest was aborted)
β β install base-bigarray base
β β install base-threads base
β β install base-unix base
β β install host-arch-x86_64 1
β β install host-system-other 1
β β install ocaml-options-vanilla 1
ββ
# Run eval $(opam env --switch=5.2.0) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] y
So, I apparently canβt compile compilers. What should I do?