-
Notifications
You must be signed in to change notification settings - Fork 31
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
Expose flags though files and enable the use of -runtime-variant #50
Conversation
For mirage/mirage#969 Instead of pkg-config, one can use the following files to get the compilation flags: ocaml-freestanding/libs ocaml-freestanding/cflags
This way we can use the ocamlopt `-runtime-variant` option.
flags/cflags: flags/cflags.tmp Makeconf | ||
for PKG in $(PKG_CONFIG_DEPS); do \ | ||
echo " " >> flags/cflags.tmp;\ | ||
env PKG_CONFIG_PATH=$(shell opam config var prefix)/lib/pkgconfig pkg-config $$PKG --cflags >> flags/cflags.tmp;\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this work when opam is not available? Also you may want to use $(shell opam config var lib)
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this would require the dunification of mirage/ocaml-freestanding
and solo5/bindings
. Should I try to achieve that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheLortex if you try that, I'd wait for require >=4.08.0
since that ships with dune files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes sure. I noticed that the configure script already depends on opam. But another solution to make it work without opam is to do like in install.sh
, which requires either to have opam or to specify manually the prefix:
prefix=${1:-$PREFIX}
if [ "$prefix" = "" ]; then
prefix=`opam config var prefix`
fi
@TheLortex This change looks reasonable in isolation, as I understand it your changes are orthogonal to the current OPAM/pkg-config based setup? However, what I'm missing is the big picture/long-term overview of what you're trying to achieve, especially in relation to upstream (solo5-bindings-*). Is the plan to dune-ify everything, getting rid of the dependency on pkg-config along the way? Also, what is the role of |
These changes are orthogonal to the current behavior. It enables a new way of gathering flags that doesn't use pkg-config and that makes it easier to build downstream libraries with dune.
Therefore |
Right, but the new way is dependent on all downstreams using dune for building, correct? Also, pkg-config will not be gone entirely until it's also removed upstream (from Solo5). So, effectively we're stuck with both mechanisms (pkg-config and this new mechanism) until some future time that everything is dune-ified?
I'm the author and maintainer of Solo5, so I might be able to help with that, but am trying to understand the wider plan. Is there some "Dune manual" or other document, or examples that I can look at to understand better what the final result would look like? |
(merging this as the discussion is not a blocker for that) |
Hi @mato, The ultimate goal here is to consolidate the build strategy for unikernels: make it possible to build unikernels themselves using dune, port the mirage libraries to dune, and make the different tricks used in mirage first class features. In particular, replacing the following current practices is in scope:
@TheLortex made a list of different points that are missing, as well as a plan in mirage/mirage#969. For this PR, the idea is to expose an alternative interface to packages that depend on I hope that clarifies a bit the situation, let me (or @TheLortex) know if something could be clearer :) |
This sounds good, and thank you for the explanation. A note about the use of pkg-config in Solo5: The reason it is used here is because this mechanism was originally used to pass around CFLAGS / LDFLAGS / library dependencies by mirage-xen, so we copied it for Solo5. In the future we may replace it with something else, however whatever mechanism is used (for example, presenting a proper cross toolchain) should not itself depend on dune or OCaml build tools. Of course, downstream of the Solo5 packages, i.e. ocaml-freestanding and its dependencies are fine to transition to a dune-based mechanism entirely. |
These files were added in mirage#50 (v0.4.3) when we planned to use this path to compile MirageOS. Time has changed, and there is a different plan now, which makes these superfluous.
These files were added in mirage#50 (v0.4.3) when we planned to use this path to compile MirageOS. Time has changed, and there is a different plan now, which makes these superfluous.
For mirage/mirage#969
Instead of pkg-config, one can use the following files to get compilation flags:
For example with dune this allows to write
%{lib:ocaml-freestanding:cflags}
to get the flags instead of having a script invokingpkg-config ocaml-freestanding --cflags
.Moreover
libasmrun.a
is symlinked in the ocaml directory in order to be able to use ocamlopt's-runtime-variant
option.