opam switch create catenable ocaml-base-compiler.4.07.1
failed with output (trimmed) like this:
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocaml-base-compiler.4.07.1] found in cache
...
[ERROR] The compilation of ocaml-base-compiler failed at
"/home/???/.opam/opam-init/hooks/sandbox.sh build make world".
...
# /usr/bin/ld: backtrace.pic.o:/home/???/.opam/catenable/.opam-switch/build/ocaml-base-compile
r.4.07.1/byterun/backtrace.c:31: multiple definition of `caml_debug_info'; backtrace_prim.pic.o:/hom
e/???/.opam/catenable/.opam-switch/build/ocaml-base-compiler.4.07.1/byterun/backtrace_prim.c:4
7: first defined here
# collect2: error: ld returned 1 exit status
# make[1]: *** [Makefile:208: libcamlrun_shared.so] Error 1
# make[1]: Leaving directory '/home/???/.opam/catenable/.opam-switch/build/ocaml-base-compiler
.4.07.1/byterun'
# make: *** [Makefile:389: coldstart] Error 2
I was confused because it looked exactly like this bug, which had been fixed months ago.
The problem went away after I did this:
opam update -a
opam upgrade
I'm guessing that opam switch create used the sources it found in my cache without checking whether they were up to date with the repo. It only picked up the patch after I instructed the update and upgrade. Does that sound plausible?
If so, would it be possible to make opam check whether its cached sources are up to date before using them?
# opam config report
# opam-version 2.0.0
# self-upgrade no
# system arch=x86_64 os=linux os-distribution=debian os-version=10.0
[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch
# read-state OpamStd.OpamSys.Exit(50)
As an aside (I know this is not your fault), I encountered this error while following this quick start guide for my first dune project. It was pretty discouraging to start my first dune project with two hours investigating a link error in the compiler, followed by an hour setting up automatic formatting, followed by an hour investigating and then working around a type error in code generated by a ppx.
If you're wondering why I started my first project with old compiler sources in my opam cache, I think they were left over from the last time I tried to set up OCaml, which resulted in my filing issues with the ocaml and opam repos. :-(
Luckily, I have had some positive experiences with OCaml before, so I am not so easily discouraged. :-)
failed with output (trimmed) like this:
I was confused because it looked exactly like this bug, which had been fixed months ago.
The problem went away after I did this:
I'm guessing that
opam switch createused the sources it found in my cache without checking whether they were up to date with the repo. It only picked up the patch after I instructed theupdateandupgrade. Does that sound plausible?If so, would it be possible to make opam check whether its cached sources are up to date before using them?
As an aside (I know this is not your fault), I encountered this error while following this quick start guide for my first dune project. It was pretty discouraging to start my first dune project with two hours investigating a link error in the compiler, followed by an hour setting up automatic formatting, followed by an hour investigating and then working around a type error in code generated by a ppx.
If you're wondering why I started my first project with old compiler sources in my opam cache, I think they were left over from the last time I tried to set up OCaml, which resulted in my filing issues with the ocaml and opam repos. :-(
Luckily, I have had some positive experiences with OCaml before, so I am not so easily discouraged. :-)