Closed RyanGibb closed 2 years ago
It's a strange error.
Have you tried building ocaml-solo5 locally ?
git clone https://github.com/mirage/ocaml-solo5
./configure --target=x86_64-solo5-none-static
make
That works on the first run. A subsequent run fails with the same error!
$ make
...
../runtime/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -a -o stdlib.cma camlinternalFormatBasics.cmo camlinternalAtomic.cmo stdlib.cmo stdlib__Pervasives.cmo stdlib__Seq.cmo stdlib__Option.cmo stdlib__Either.cmo stdlib__Result.cmo stdlib__Bool.cmo stdlib__Char.cmo stdlib__Uchar.cmo stdlib__Sys.cmo stdlib__List.cmo stdlib__Int.cmo stdlib__Bytes.cmo stdlib__String.cmo stdlib__Unit.cmo stdlib__Marshal.cmo stdlib__Obj.cmo stdlib__Array.cmo stdlib__Float.cmo stdlib__Int32.cmo stdlib__Int64.cmo stdlib__Nativeint.cmo stdlib__Lexing.cmo stdlib__Parsing.cmo stdlib__Set.cmo stdlib__Map.cmo stdlib__Stack.cmo stdlib__Queue.cmo camlinternalLazy.cmo stdlib__Lazy.cmo stdlib__Stream.cmo stdlib__Buffer.cmo camlinternalFormat.cmo stdlib__Printf.cmo stdlib__Arg.cmo stdlib__Atomic.cmo stdlib__Printexc.cmo stdlib__Fun.cmo stdlib__Gc.cmo stdlib__Digest.cmo stdlib__Random.cmo stdlib__Hashtbl.cmo stdlib__Weak.cmo stdlib__Format.cmo stdlib__Scanf.cmo stdlib__Callback.cmo camlinternalOO.cmo stdlib__Oo.cmo camlinternalMod.cmo stdlib__Genlex.cmo stdlib__Ephemeron.cmo stdlib__Filename.cmo stdlib__Complex.cmo stdlib__ArrayLabels.cmo stdlib__ListLabels.cmo stdlib__BytesLabels.cmo stdlib__StringLabels.cmo stdlib__MoreLabels.cmo stdlib__StdLabels.cmo stdlib__Bigarray.cmo
../runtime/ocamlrun ../boot/ocamlc -use-prims ../runtime/primitives -strict-sequence -absname -w +a-4-9-41-42-44-45-48-70 -g -warn-error +A -bin-annot -nostdlib -principal -safe-string -strict-formats -c std_exit.ml
echo '#!/usr/local/solo5-sysroot/bin/ocamlrun' > camlheader
echo '#!/usr/local/solo5-sysroot/bin/ocamlrun' > target_camlheader
echo '#!' | tr -d '\012' > camlheader_ur
echo '#!/usr/local/solo5-sysroot/bin/ocamlrund' > camlheaderd
echo '#!/usr/local/solo5-sysroot/bin/ocamlrund' > target_camlheaderd
make[2]: Leaving directory '/home/ryan/projects/ocaml-solo5/ocaml/stdlib'
cp runtime/ocamlrun boot/ocamlrun
cd boot; rm -f stdlib.cma std_exit.cmo *.cmi camlheader
cd stdlib; cp stdlib.cma std_exit.cmo *.cmi camlheader ../boot
cd boot; ln -sf ../runtime/libcamlrun.a .
make all
make[2]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml'
make -C runtime all
make[3]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml/runtime'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/ryan/projects/ocaml-solo5/ocaml/runtime'
cd stdlib; ln -sf ../runtime/libcamlrun.a .
make ocamlc
make[3]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml'
./boot/ocamlrun ./boot/ocamlc -g -nostdlib -I boot -use-prims runtime/primitives -strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66-70 -warn-error +a -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp -I file_formats -I lambda -I middle_end -I middle_end/closure -I middle_end/flambda -I middle_end/flambda/base_types -I asmcomp -I driver -I toplevel -c utils/warnings.mli
./boot/ocamlrun ./boot/ocamlc -g -nostdlib -I boot -use-prims runtime/primitives -strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66-70 -warn-error +a -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp -I file_formats -I lambda -I middle_end -I middle_end/closure -I middle_end/flambda -I middle_end/flambda/base_types -I asmcomp -I driver -I toplevel -c parsing/location.mli
...
$ make
make -C ocaml world
make[1]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml'
make -C runtime all
make[2]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml/runtime'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ryan/projects/ocaml-solo5/ocaml/runtime'
make -C stdlib \
OCAMLRUN='$(ROOTDIR)/runtime/ocamlrun' \
CAMLC='$(BOOT_OCAMLC) -use-prims ../runtime/primitives' all
make[2]: Entering directory '/home/ryan/projects/ocaml-solo5/ocaml/stdlib'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ryan/projects/ocaml-solo5/ocaml/stdlib'
cp runtime/ocamlrun boot/ocamlrun
cp: cannot create regular file 'boot/ocamlrun': Permission denied
make[1]: *** [Makefile:165: coldstart] Error 1
make[1]: Leaving directory '/home/ryan/projects/ocaml-solo5/ocaml'
make: *** [Makefile:112: ocaml] Error 2
https://github.com/tweag/opam-nix/commit/5ecf937dbdbba69ac2cba9a6d17332e9912b6978 solves this for nix derivations with an overlay changing the permissions.
I managed to build this locally with a project switch. It failed initially with OCaml 4.13.1, worked with 4.14.1, and the worked again while reverting to 4.13.1. There's something weird going on here.
Also managed to get building in a mirage unikernel project with a local switch, but only after doing the above shenanigans with versions.
Hmm, I think this is something to do with using a NixOS system install of OCaml. Installing a different (4.14.1) version to the local switch solves this. The ocaml-solo5
makefile runs cp -r `opam var prefix`/lib/ocaml-src ./ocaml
, so it mustn't play nice with the compiler in the /nix/store
(does installing ocaml
install ocaml-src
?).