Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to dune-lang 2, remove minios-based xen support, add solo5-based xen support, add unikernel for testing #86

Merged
merged 4 commits into from
Oct 21, 2020

Conversation

hannesm
Copy link
Member

@hannesm hannesm commented Oct 17, 2020

dune 2 deprecated c_names & c_flags in a stanza, use foreign_library instead

@dinosaure
Copy link
Member

You should, at least, add a new .ocamlformat file with:

version = 0.15.0
disable = true

@hannesm hannesm force-pushed the dune2 branch 3 times, most recently from 8c30dbb to 374bba0 Compare October 17, 2020 13:09
@dinosaure
Copy link
Member

Just a curious question, why you choose to use Makefile instead of cflags.sh?

@hannesm
Copy link
Member Author

hannesm commented Oct 17, 2020

@dinosaure based on the discussion in mirage/mirage-xen#23, when using dune's support for compiling C code it always embeds some C flags in the process (-fPIC), and also builds both an archive and a shared object -- which is not what we want here.

@dinosaure
Copy link
Member

@dinosaure based on the discussion in mirage/mirage-xen#23, when using dune's support for compiling C code it always embeds some C flags in the process (-fPIC), and also builds both an archive and a shared object -- which is not what we want here.

Hmmhmm, that means I need to do an update on digestif and checkseum, it's correct?

@hannesm
Copy link
Member Author

hannesm commented Oct 17, 2020

@dinosaure yes, I propose to wait until mirage-xen 6.0.0 is out in the open, and then revise once all our C artifacts. There'll be another round of revising them when either mirage or dune is enhanced with different cross-compilation support.

@hannesm
Copy link
Member Author

hannesm commented Oct 17, 2020

having said this, at the moment there's no need for action since we're (by luck) getting usable unikernels -- in general mixing PIC and non-PIC compiled objects is undefined behaviour, and a showstopper for PIE binaries.

dune 2 deprecated c_names & c_flags in a stanza, use foreign_library instead
As discussed in mirage/mirage-xen#23, using dune's C compilation support leads
to unexpected CFLAGS, especially -fPIC and -fno-strict-aliasing in our setup.

To regain control of CFLAGS, instead use a Makefile. There's no need for the
OCaml mirage-crypto.freestanding / mirage-crypto.xen sublibraries anymore.
Failure of compilation are allowed if the respective opam packages
(mirage-xen-posix, ocaml-freestanding) are not installed.

For a successful cold `dune build @install` run, (alias install) is added to
the (copy-files# ..) stanze in xen/dune and freestanding/dune.

The libmirage_crypto_{xen,freestanding}_stubs.a are installed directly in the
lib/mirage-crypto/ directory.
@hannesm
Copy link
Member Author

hannesm commented Oct 17, 2020

This is ready for review, CI is green, and awaiting your feedback. I additionally tested it full-circle with a solo5 MirageOS unikernel successfully.

This PR consists of 4 commits: (a) use dune 2.x (in preparation for b, maintenance), (b) use a Makefile for cross-compilation (see mirage/mirage-xen#23) to have control over CFLAGS, (c) remove minios-based xen support, add solo5-based xen support, (d) a test unikernel used in travis and cirrus.

The new xen stack uses ocaml-freestanding, gmp-xen and zarith-xen are no longer
used across the chain. This simplifies the setup massively, and no longer
requires the xen subdirectory for cross-compilation.

This removes CI jobs for xen-based MirageOS unikernels (to be added again once
mirage with solo5-based xen support is released).
@hannesm hannesm force-pushed the dune2 branch 2 times, most recently from 264ac34 to 344b3f4 Compare October 17, 2020 15:48
@hannesm hannesm changed the title build system: upgrade to dune 2 upgrade to dune-lang 2, remove minios-based xen support, add solo5-based xen support, add unikernel for testing Oct 17, 2020
@hannesm hannesm force-pushed the dune2 branch 5 times, most recently from 9bbd9d7 to 5c00d94 Compare October 17, 2020 17:35
The motivation is to detect linking issues with mirage as early as possible.
@hannesm hannesm merged commit 7dce8a4 into mirage:master Oct 21, 2020
@hannesm hannesm deleted the dune2 branch October 21, 2020 19:38
hannesm added a commit to hannesm/opam-repository that referenced this pull request Oct 21, 2020
…mirage-crypto-rng-mirage (0.8.6)

CHANGES:

* Detect CPU architecture from C compiler, allowing cross-compiling to Android
  and iOS (mirage/mirage-crypto#84 by @EduardoRFC)
* Upgrade to dune2, use a Makefile for building freestanding libraries, drop
  mirage-xen-posix support (solo5-based PVH exists now) mirage/mirage-crypto#86 by @hannesm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants