I am trying to build compilerlibs/ocamlcommon.cmxa
of an older branch of OCaml, namely 4.06.1+BS
, using OCaml 4.10.2. However I ran into the Error: Unbound module Stdlib
on most of the targets. For example the following does NOT work:
../../../../inria/ocaml/boot/ocamlrun ../../../../inria/ocaml/boot/ocamlc -use-prims ../byterun/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats `sh ./Compflags list.cmi` -c list.mli
However these two worked:
../../../../inria/ocaml/boot/ocamlrun ../../../../inria/ocaml/boot/ocamlc -use-prims ../byterun/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats `sh ./Compflags camlinternalFormatBasics.cmi` -c camlinternalFormatBasics.mli ../../../../inria/ocaml/boot/ocamlrun ../../../../inria/ocaml/boot/ocamlc -use-prims ../byterun/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats `sh ./Compflags camlinternalFormatBasics.cmo` -c camlinternalFormatBasics.ml ../../../../inria/ocaml/boot/ocamlrun ../../../../inria/ocaml/boot/ocamlc -use-prims ../byterun/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats `sh ./Compflags pervasives.cmi` -c pervasives.mli ../../../../inria/ocaml/boot/ocamlrun ../../../../inria/ocaml/boot/ocamlc -use-prims ../byterun/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48 -g -warn-error A -bin-annot -nostdlib -safe-string -strict-formats `sh ./Compflags pervasives.cmo` -c pervasives.ml
But the same thing worked when 4.10.2
was bootstrapping itself. The difference is that the more up-to-date build process has stdlib.ml
and compiles that first. Is there a way to get past this?
The context for this attempt is that I am trying to see if I can build a native M1 binary for the ReScript compiler (or bs-platform
), and hopefully figure out a way to decouple the ReScript build from OCaml’s own backend native code generation. 4.10.2
works on native M1, so in theory I should be able to use it to compile an earlier version of compiler to native, no? Sure the binary code generation of the older version still would not work but here we only need the frontend of the older compiler to work.