I had some spare time and gave it a try,
It seemed to work as expected (with and without -nopervasives
).
Cheers,
Nicolas
I had some spare time and gave it a try,
It seemed to work as expected (with and without -nopervasives
).
Cheers,
Nicolas
The key part of my problem is that I am compiling with docker.
$ git diff
diff --git a/Makefile b/Makefile
index a7c87fc..40a30f8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
top: data.ml top.ml
- ocamlmktop -o $@ $^
+ ocamlmktop -custom -o $@ $^
data.ml: make_data.ml
ocaml -I +compiler-libs ocamlcommon.cma $^ > $@
$ docker run --rm -v /tmp/selfcontained-ocaml-toplevel:/tmp/selfcontained-ocaml-toplevel gwrepl /bin/bash -c 'eval $(opam env) && cd /tmp/selfcontained-ocaml-toplevel && make clean top'
rm -f top *.cm*
ocamlmktop -custom -o top data.ml top.ml
$ ./top
OCaml version 4.09.1
File "command line", line 1:
Error: Unbound module Stdlib
Your example might work (I mean fail) with any docker image, I guess.
PS: I’ll copy the way you write your get
function, thanks
PPS: without the -custom
, I have an error about ocamlrun being wrong version, I do not remember. Note that my docker and my computer have different OCaml version, but at the end, I want to distribute the tool to computers (possibly) without ocaml at all.
I might have a clue: with @nojb’s repo, the resulting toplevel works if it’s compiled with a recent compiler, but doesn’t work if I compile it with 4.09.0.
Can you adapt your docker image so that it uses a more recent version of OCaml ?
It works with a recent OCaml indeed!
$ docker run --rm -v /tmp/selfcontained-ocaml-toplevel:/tmp/selfcontained-ocaml-toplevel geneweb-20.04-4.11.2 /bin/bash -c 'eval $(opam env) && cd /tmp/selfcontained-ocaml-toplevel && make clean top'
rm -f top *.cm*
ocamlmktop -custom -o top data.ml top.ml
jsagot@jsagot-XPS:/tmp/selfcontained-ocaml-toplevel$ ./top
OCaml version 4.11.2
+ loading Stdlib from marshalled copy
Cannot find file topfind.
#