Cannot install ocaml 4.07.1 (multiple definition of `caml_debug_info')

I want to install flow parser, so I need an OCaml older than 4.07.1. Unfortunately I cannot install it using opam in a local switch:

[ERROR] The compilation of ocaml-base-compiler failed at "/home/schmitta/.opam/opam-init/hooks/sandbox.sh build make -j7 world".

#=== ERROR while compiling ocaml-base-compiler.4.07.1 =========================#
# context     2.0.7 | linux/x86_64 |  | https://opam.ocaml.org#2d5e1096
# path        ~/work/skeletons/jskel/_opam/.opam-switch/build/ocaml-base-compiler.4.07.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make -j7 world
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-8727-6d07ae.env
# output-file ~/.opam/log/ocaml-base-compiler-8727-6d07ae.out
### output ###
# (echo '#define CAML_INTERNALS'; \
# [...]
#  sed -e 's/.*/	"&",/' primitives; \
#  echo '	 0 };') > prims.c
# gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -fno-tree-vrp  -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  prims.c
# gcc -O2 -fno-strict-aliasing -fwrapv -Wall -fno-tree-vrp  -g -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE  -Wl,-E -o ocamlruni prims.o libcamlruni.a -lm  -ldl -lpthread 
# /usr/bin/ld: libcamlruni.a(backtrace.i.o):/home/schmitta/work/skeletons/jskel/_opam/.opam-switch/build/ocaml-base-compiler.4.07.1/byterun/backtrace.c:31: multiple definition of `caml_debug_info'; libcamlruni.a(backtrace_prim.i.o):/home/schmitta/work/skeletons/jskel/_opam/.opam-switch/build/ocaml-base-compiler.4.07.1/byterun/backtrace_prim.c:47: first defined here
# rm -f libcamlrund.a && ar rc libcamlrund.a  interp.d.o misc.d.o stacks.d.o fix_code.d.o startup_aux.d.o startup.d.o freelist.d.o major_gc.d.o minor_gc.d.o memory.d.o alloc.d.o roots.d.o globroots.d.o fail.d.o signals.d.o signals_byt.d.o printexc.d.o backtrace_prim.d.o backtrace.d.o compare.d.o ints.d.o floats.d.o str.d.o array.d.o io.d.o extern.d.o intern.d.o hash.d.o sys.d.o meta.d.o parsing[...]
# collect2: error: ld returned 1 exit status
# make[1]: *** [Makefile:199: ocamlruni] Error 1
# make[1]: *** Waiting for unfinished jobs....
# make[1]: Leaving directory '/home/schmitta/work/skeletons/jskel/_opam/.opam-switch/build/ocaml-base-compiler.4.07.1/byterun'
# make: *** [Makefile:389: coldstart] Error 2

I’m using gcc 10.1.0, so it might be related to https://github.com/ocaml/ocaml/issues/9144

Is there a way to work around this? Should I file a bug report?

That’s a know issue (see https://github.com/ocaml/opam-repository/issues/16538 for the issue on the opam-repository and https://github.com/ocaml/opam-repository/pull/16583 for the fix, which should be merged soon I think).
Meanwhile, you can take a look at this thread : Opam switch create and gcc10 for a manual solution.

Hi, when I pointed you at Flow back in Library to parse JavaScript in opam? , I’m pretty sure I tried it on OCaml 4.09. I did pin to the latest commit in the repo directly though, not the version published on opam, which was quite old: Library to parse JavaScript in opam?

But looking at the published opam package, even there is says that the required OCaml version is >=4.03.0, so it should still work on say 4.09.

EDIT: confirmed working with 4.09

Thank you for the suggestion!

I’m sorry, I forgot to pin the package. This was why it would not install on 4.08 and above. Thank you for reminding me!