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

Local dune libraries are not accessible within a mirage project #1372

Open
kit-ty-kate opened this issue Nov 9, 2022 · 4 comments
Open

Local dune libraries are not accessible within a mirage project #1372

kit-ty-kate opened this issue Nov 9, 2022 · 4 comments

Comments

@kit-ty-kate
Copy link
Contributor

Using mirage-skeleton's hello project as an example, adding a simple local dune library such as:

$ mkdir lib
$ echo "(library (name my_local_lib))" > lib/dune

then trying to declare it in mirage:

-let main = main ~packages:[ package "duration" ] "Unikernel.Hello" (time @-> job)
+let main = main ~packages:[ package "duration"; package "my_local_lib" ] "Unikernel.Hello" (time @-> job)

Will make opam-monorepo fail during make depends as my_local_lib is not an opam project available in opam-repository (and even if there was that would cause a conflict between the vendored duniverse/my_local_lib and my_local_lib)

Could there be an additional parameter to Mirage.package to declare the package as a local library?

@kit-ty-kate
Copy link
Contributor Author

kit-ty-kate commented Nov 9, 2022

If anybody else is looking for a solution, the following hack works ok for me: https://github.com/kit-ty-kate/exn.st/blob/79bd396ef04ffbc22b8660d46286c7b39b54a13c/Dockerfile#L5

@hannesm
Copy link
Member

hannesm commented Nov 9, 2022

As stated on IRC, I think the way to achieve this is to run mirage configure in the top-level with -f my_unikernel/config.ml, and thereafter dune build --root . my_unikernel/dist which will take the local lib into account.

That's at least from my memory/experience, you may want to take a look at https://github.com/mirage/mirage-crypto/blob/main/.test-mirage.sh (executed by .e.g .cirrus.yml) that attempts to compile these unikernels as a CI job with the HEAD of mirage-crypto...

@kit-ty-kate
Copy link
Contributor Author

I think it isn’t great if the expected toolchain (mirage configure && make depends && mirage build) does not work and we have to go out of our way to make something that should have a simple solution, happen.

It would be nice to have an extra ?local_libs:string list argument to Mirage.main, to be able to do that out of the box.

@hannesm
Copy link
Member

hannesm commented Nov 10, 2022

agreed, related to #1371

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

No branches or pull requests

2 participants