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

OCaml #255

Open
EddieOhlson opened this issue Jul 11, 2019 · 5 comments
Open

OCaml #255

EddieOhlson opened this issue Jul 11, 2019 · 5 comments

Comments

@EddieOhlson
Copy link

When running the
opam install uri qcow.0.10.4 conduit.1.0.0 lwt.3.1.0 qcow-tool mirage-block-unix.2.9.0 conf-libev logs fmt mirage-unix prometheus-app
I received the following error that my OCaml was to new 4.08.0.
So I had to do opam switch create ocaml-base-compiler 4.07.1 and reran the code.

@jkzilla
Copy link

jkzilla commented Jun 30, 2020

 hyperkit % opam install uri qcow.0.10.4 conduit.1.0.0 lwt.3.1.0 qcow-tool mirage-block-unix.2.9.0 conf-libev logs fmt mirage-unix prometheus-app
The following dependencies couldn't be met:
  - lwt → ocaml < 4.08.0
      base of this switch (use `--unlock-base' to force)

No solution found, exiting

@jheinnic
Copy link

I've got the same dependencies not met error message posted by jkzilla above when following the direction for enabling qcow2 support. I took the prompted suggestion and added a --unlock-base argument to the opam install command and it ran a very long build for several hours.

After returning to hyperkit, I ran opam config env as indicated, and then make. It compiled one additional object file, then attempted a link step and failed as follows:

make
cc src/lib/mirage_block_c.c
ml src/lib/mirage_block_ocaml.ml
ld hyperkit.sym
undef: _caml_mirage_iopage_alloc_pages
undef: _caml_mirage_iopage_get_addr
Undefined symbols for architecture x86_64:
  "_caml_mirage_iopage_alloc_pages", referenced from:
      _camlIo_page__get_205 in mirage_block_ocaml.o
      _camlIo_page__1 in mirage_block_ocaml.o
  "_caml_mirage_iopage_get_addr", referenced from:
      _camlIo_page__get_addr_159 in mirage_block_ocaml.o
      _camlIo_page__get_page_162 in mirage_block_ocaml.o
      _camlIo_page__1 in mirage_block_ocaml.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/hyperkit.sym] Error 1

I also attempted this from scratch with a make clean. Diffing the outputs before and after shows the only difference was the additional cc, ml, and ld commands, all with the same apparent result.

This is running on an instance of MacOS Catalina. I had no prior oCaml installation before acquiring the tools via homebrew as described here.

@jheinnic
Copy link

Noticing my compiler is 4.12, even more newer than 4.07.1 as reported by the initiator of this ticket. Attempting the steps he took by switching the base compiler version. If that turns out to be a work-around that yields a correct compilable result that links when the downstream make is run, then perhaps the resolution to this issue is just an update to the project README file?

Anyhow, I'll see where this gets me. May take a while, given the first experience.

@jheinnic
Copy link

The opam install step ran much more happily after running ``:

[Wed Apr 28, 17:24:15] $ opam install uri qcow.0.11.0 conduit.2.1.0 lwt.5.3.0 qcow-tool mirage-block-unix.2.12.0 conf-libev logs fmt mirage-unix prometheus-app

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><>  🐫 
[qcow-tool.0.11.0] no changes from git://github.com/mirage/ocaml-qcow
[qcow.0.11.0] no changes from git://github.com/mirage/ocaml-qcow

[NOTE] Package prometheus-app is already installed (current version is 1.0).
[NOTE] Package mirage-unix is already installed (current version is 4.0.1).
[NOTE] Package fmt is already installed (current version is 0.8.9).
[NOTE] Package logs is already installed (current version is 0.7.0).
[NOTE] Package conf-libev is already installed (current version is 4-11).
[NOTE] Package mirage-block-unix is already installed (current version is 2.12.0).
[NOTE] Package qcow-tool is already installed (current version is 0.11.0).
[NOTE] Package lwt is already installed (current version is 5.3.0).
[NOTE] Package conduit is already installed (current version is 2.1.0).
[NOTE] Package qcow is already installed (current version is 0.11.0).
[NOTE] Package uri is already installed (current version is 4.1.0).

... but it looks like much the same linking error in the final result, with one additional missing symbol (_caml_ba_map_file) ...

ld hyperkit.sym
undef: _caml_mirage_iopage_alloc_pages
undef: _caml_ba_map_file
undef: _caml_mirage_iopage_get_addr
Undefined symbols for architecture x86_64:
  "_caml_mirage_iopage_alloc_pages", referenced from:
      _camlIo_page__get_1298 in mirage_block_ocaml.o
      _camlIo_page__21 in mirage_block_ocaml.o
  "_caml_ba_map_file", referenced from:
      _camlBigarray__map_file_inner_2597 in mirage_block_ocaml.o
      _camlBigarray__5 in mirage_block_ocaml.o
  "_caml_mirage_iopage_get_addr", referenced from:
      _camlIo_page__get_addr_1259 in mirage_block_ocaml.o
      _camlIo_page__get_page_1261 in mirage_block_ocaml.o
      _camlIo_page__21 in mirage_block_ocaml.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build/hyperkit.sym] Err
Looks like the same broken symbols as before, just with different dynamic indices appended, plus some new ones for _caml_ba_map_file.  

@cakemanny
Copy link

Looks like there were breaking changes in https://github.com/mirage/io-page/releases/tag/v2.4.0
I imagine the real solution is for mirage-block-unix to set an upper bound for the that package, or update to deal with the changes.
If you want to get the build working temporarily, this works:

diff --git a/hyperkit.opam b/hyperkit.opam
index 9492872..06948bf 100644
--- a/hyperkit.opam
+++ b/hyperkit.opam
@@ -20,5 +20,6 @@ depends: [
   "fmt"
   "mirage-unix"
   "prometheus-app"
+  "io-page"           {= "2.3.0"}
 ]
 synopsis: "Uses the Hypervisor.framework on macOS to run Linux VMs"

and instead of running

opam install uri qcow.0.11.0 conduit.2.1.0 lwt.5.3.0 qcow-tool mirage-block-unix.2.12.0 conf-libev logs fmt mirage-unix prometheus-app

one can just run

opam install -w . --deps-only

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

4 participants