Closed TheLortex closed 2 years ago
I've added a new commit for the mirage 3 compatibility. Currently freestanding C stubs use pkg-config --cflags ocaml-freestanding
to find the correct flags, but the new solo5 changes break this behavior as the C stubs should be built using the solo5 compiler toolchain.
So we have a choice to make:
bigstringaf
, mirage-crypto
, tcpip
, ...) and cut patch releases to keep the mirage 3 compatpkg-config --cflags ocaml-freestanding
to bring back the old behavior. This is what this additional commit does. It relies on solo5 installing a .pc
file to describe its toolchain flags. This way, from a mirage 3 point of view, the transition to the new ocaml-freestanding is transparent. modify the flags exposed by pkg-config --cflags ocaml-freestanding to bring back the old behavior. This is what this additional commit does. It relies on solo5 installing a .pc file to describe its toolchain flags. This way, from a mirage 3 point of view, the transition to the new ocaml-freestanding is transparent.
Thanks for this update, as I said, both options are fine in the scope of the release of MirageOS 4 - even if the second one is better (because it's transparent). I hope, it's the last contentious piece between MirageOS 3 & MirageOS 4.
Rebased with master
:+1:.
Ok, the ocaml-ci
fails because it tries to install all *.opam
packages when they have a conflict between them. I don't know how to fix that.
So, at least (and it does not appear on this PR), GitHub actions works and Cirrus CI too - we can consider it as the final draft of ocaml-freestanding
for MirageOS 4-rc1.
I addressed most comments in #104 - remaning are SAK changes and arm64 libgcc. feel free to merge #104 here or continue there. This all looks fine to be merged and released.
Close by #104
This PR replaces https://github.com/mirage/ocaml-freestanding/pull/90. The introduction of the PR is still relevant.
Thanks to @mato's work on solo5 (https://github.com/Solo5/solo5/pull/494), we finally have a good and future-proof scheme for ocaml-freestanding. What happens is that for each solo5 toolchain, we will install an ocaml compiler distribution configured with that toolchain. For now, we only have one toolchain which is
solo5-none-static
.From the toolchain name is derived a compiler and a linker to use:
x86_64-solo5-none-static-cc
andx86_64-solo5-none-static-ld
which are used to build a freestanding libc/libm and a freestanding cross-compiler. The distribution is installed under the ocamlfind toolchain namefreestanding
.This cross-compiler can then be used by ocaml projects to build solo5 unikernels. I've added an
example/
folder to display the layout of such a project. Warning: existing projects depending on ocaml-freestanding will be broken, because they will use the host compiler instead ofARCH-solo5-none-static-cc
. These projects should be updated so that they usepkg-config --var=cc ocaml-freestanding
to figure out the correct compiler to use.Because of the lack of unix functions,
libcamlrun.a
is not built. So only native code compilation is supported. I've added CI to test it on4.10
,4.11
and4.12
ubuntu, and updated the cirrus CI for freebsd testing.