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

build failure when using dune and cross-compiling (mirageos) #7819

Closed
hannesm opened this issue May 27, 2023 · 5 comments
Closed

build failure when using dune and cross-compiling (mirageos) #7819

hannesm opened this issue May 27, 2023 · 5 comments

Comments

@hannesm
Copy link
Member

hannesm commented May 27, 2023

Dear Madam or Sir,

with great pleasure I use dune to compile MirageOS unikernels. Unfortunately, I observe every now and then the following on the console:

dune verson is 3.7.1

The directory I'm in is a cloned https://github.com/roburio/tlstunnel at 33733664f9fd0e4dcd4c60e79368d0d59494ca62 - inside of the "unikernel" subdirectory.

[18:39 hannes@neo:unikernel] mirage configure -t hvt
[18:39 hannes@neo:unikernel] gmake lock pull build
gmake[1]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
gmake[2]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
e[2musing overlay repository mirage: [opam-overlays, mirage-overlays] e[0m
[opam-overlays] no changes from git+https://github.com/dune-universe/opam-overlays.git
[NOTE] Repository opam-overlays has been added to the selections of switch tls-no-sexp only.
       Run `opam repository add opam-overlays --all-switches|--set-default' to use it in all existing
       switches, or in newly created switches, respectively.

[mirage-overlays] no changes from git+https://github.com/dune-universe/mirage-opam-overlays.git
[NOTE] Repository mirage-overlays has been added to the selections of switch tls-no-sexp only.
       Run `opam repository add mirage-overlays --all-switches|--set-default' to use it in all existing
       switches, or in newly created switches, respectively.

gmake[2]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
 ↳ generate lockfile for monorepo dependencies
==> Using 1 locally scanned package as the target.
[WARNING] Unknown variable "ocaml-system:version"
[WARNING] Unknown variable "ocaml-base-compiler:version"
[WARNING] Unknown variable "ocaml-variants:version"
[WARNING] Unknown variable "ocaml-system:version"
[WARNING] Unknown variable "ocaml-base-compiler:version"
[WARNING] Unknown variable "ocaml-variants:version"
==> Found 100 opam dependencies for the target package.
==> Querying opam database for their metadata and Dune compatibility.
==> Calculating exact pins for each of them.
==> Wrote lockfile with 52 entries to mirage/tlstunnel-hvt.opam.locked. You can now run opam monorepo pull to fetch their sources.
gmake[2]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
e[2mremoving overlay repository [opam-overlays, mirage-overlays]e[0m
Repositories removed from the selections of switch tls-no-sexp. Use '--all' to forget about them altogether.
Repositories removed from the selections of switch tls-no-sexp. Use '--all' to forget about them altogether.
gmake[2]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
gmake[1]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel/unikernel'
 ↳ fetch monorepo dependencies in the duniverse folder
==> Using lockfile mirage/tlstunnel-hvt.opam.locked
Successfully pulled 52/52 repositories
mirage build -f config.ml
File "dune.build", line 7, characters 7-11:
7 |  (name main)
           ^^^^
ld.lld: error: unable to find library -lgmp
cc: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
gmake: *** [Makefile:56: build] Error 1

Now, that's rather inconvenient. I managed to capture more verbose output:

dune build --root . --verbose
Shared cache: enabled
Workspace root: /usr/home/hannes/devel/mirage/tlstunnel/unikernel
Auto-detected concurrency: 4
Running[0]: /usr/home/hannes/.opam/tls-no-sexp/bin/ocamlc.opt -config > /tmp/dune_e33122_output
Running[1]: /usr/home/hannes/.opam/tls-no-sexp/bin/ocamlfind printconf conf > /tmp/dune_abf828_output
Running[2]: /usr/home/hannes/.opam/tls-no-sexp/bin/ocamlfind -toolchain solo5 printconf path > /tmp/dune_15cb2d_output
Running[3]: /usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlc -config > /tmp/dune_81a73d_output
Dune context:                   
 { name = "default"
 ; kind = "default"
 ; profile = Release
 ; merlin = false
 ; for_host = None
 ; fdo_target_exe = None
 ; build_dir = In_build_dir "default"
 ; toplevel_path =
     Some External "/usr/home/hannes/.opam/tls-no-sexp/lib/toplevel"
 ; ocaml_bin = External "/usr/home/hannes/.opam/tls-no-sexp/bin"
 ; ocaml = Ok External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocaml"
 ; ocamlc = External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocamlc.opt"
 ; ocamlopt =
     Ok External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocamlopt.opt"
 ; ocamldep =
     Ok External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocamldep.opt"
 ; ocamlmklib =
     Ok External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocamlmklib.opt"
 ; env =
     map
       { "DUNE_OCAML_HARDCODED" : "/usr/home/hannes/.opam/tls-no-sexp/lib"
       ; "DUNE_OCAML_STDLIB" : "/usr/home/hannes/.opam/tls-no-sexp/lib/ocaml"
       ; "DUNE_SOURCEROOT" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel"
       ; "INSIDE_DUNE" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/default"
       ; "MANPATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/default/bin"
       ; "OCAMLFIND_IGNORE_DUPS_IN" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/default/lib"
       ; "OCAMLPATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/default/lib"
       ; "OCAMLTOP_INCLUDE_PATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/default/lib/toplevel"
       ; "OCAML_COLOR" : "always"
       ; "OPAMCOLOR" : "always"
       }
 ; findlib_paths = [ External "/usr/home/hannes/.opam/tls-no-sexp/lib" ]
 ; arch_sixtyfour = true
 ; natdynlink_supported = true
 ; supports_shared_libraries = true
 ; ocaml_config =
     { version = "4.14.1"
     ; standard_library_default =
         "/usr/home/hannes/.opam/tls-no-sexp/lib/ocaml"
     ; standard_library = "/usr/home/hannes/.opam/tls-no-sexp/lib/ocaml"
     ; standard_runtime = "the_standard_runtime_variable_was_deleted"
     ; ccomp_type = "cc"
     ; c_compiler = "cc"
     ; ocamlc_cflags =
         [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread"; "-fPIC" ]
     ; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
     ; ocamlopt_cflags =
         [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread"; "-fPIC" ]
     ; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
     ; bytecomp_c_compiler =
         [ "cc"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-pthread"
         ; "-fPIC"
         ; "-D_FILE_OFFSET_BITS=64"
         ]
     ; bytecomp_c_libraries = [ "-lm"; "-lpthread" ]
     ; native_c_compiler =
         [ "cc"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-pthread"
         ; "-fPIC"
         ; "-D_FILE_OFFSET_BITS=64"
         ]
     ; native_c_libraries = [ "-lm" ]
     ; native_pack_linker = [ "ld"; "-r"; "-o" ]
     ; cc_profile = []
     ; architecture = "amd64"
     ; model = "default"
     ; int_size = 63
     ; word_size = 64
     ; system = "freebsd"
     ; asm = [ "cc"; "-c" ]
     ; asm_cfi_supported = true
     ; with_frame_pointers = false
     ; ext_exe = ""
     ; ext_obj = ".o"
     ; ext_asm = ".s"
     ; ext_lib = ".a"
     ; ext_dll = ".so"
     ; os_type = "Unix"
     ; default_executable_name = "a.out"
     ; systhread_supported = true
     ; host = "x86_64-unknown-freebsd13.1"
     ; target = "x86_64-unknown-freebsd13.1"
     ; profiling = false
     ; flambda = false
     ; spacetime = false
     ; safe_string = true
     ; exec_magic_number = "Caml1999X031"
     ; cmi_magic_number = "Caml1999I031"
     ; cmo_magic_number = "Caml1999O031"
     ; cma_magic_number = "Caml1999A031"
     ; cmx_magic_number = "Caml1999Y031"
     ; cmxa_magic_number = "Caml1999Z031"
     ; ast_impl_magic_number = "Caml1999M031"
     ; ast_intf_magic_number = "Caml1999N031"
     ; cmxs_magic_number = "Caml1999D031"
     ; cmt_magic_number = "Caml1999T031"
     ; natdynlink_supported = true
     ; supports_shared_libraries = true
     ; windows_unicode = false
     }
 }
Dune context:                   
 { name = "solo5"
 ; kind = "default"
 ; profile = Release
 ; merlin = true
 ; for_host = Some "default"
 ; fdo_target_exe = None
 ; build_dir = In_build_dir "solo5"
 ; toplevel_path =
     Some External "/usr/home/hannes/.opam/tls-no-sexp/lib/toplevel"
 ; ocaml_bin =
     External "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin"
 ; ocaml = Ok External "/usr/home/hannes/.opam/tls-no-sexp/bin/ocaml"
 ; ocamlc =
     External "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlc"
 ; ocamlopt =
     Ok
       External
         "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlopt"
 ; ocamldep =
     Ok
       External
         "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamldep"
 ; ocamlmklib =
     Ok
       External
         "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlmklib"
 ; env =
     map
       { "DUNE_OCAML_HARDCODED" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib"
       ; "DUNE_OCAML_STDLIB" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib/ocaml"
       ; "DUNE_SOURCEROOT" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel"
       ; "INSIDE_DUNE" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/solo5"
       ; "MANPATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/solo5/bin"
       ; "OCAMLFIND_IGNORE_DUPS_IN" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/solo5/lib"
       ; "OCAMLPATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/solo5/lib"
       ; "OCAMLTOP_INCLUDE_PATH" :
           "/usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/install/solo5/lib/toplevel"
       ; "OCAML_COLOR" : "always"
       ; "OPAMCOLOR" : "always"
       ; "destdir" : "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib"
       ; "ocamlc" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlc"
       ; "ocamlcp" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlcp"
       ; "ocamldep" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamldep"
       ; "ocamlmklib" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlmklib"
       ; "ocamlopt" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlopt"
       ; "path" : "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib"
       ; "stdlib" :
           "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib/ocaml"
       }
 ; findlib_paths =
     [ External "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib" ]
 ; arch_sixtyfour = true
 ; natdynlink_supported = false
 ; supports_shared_libraries = false
 ; ocaml_config =
     { version = "4.14.1"
     ; standard_library_default =
         "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib/ocaml"
     ; standard_library =
         "/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib/ocaml"
     ; standard_runtime = "the_standard_runtime_variable_was_deleted"
     ; ccomp_type = "cc"
     ; c_compiler = "x86_64-solo5-none-static-cc"
     ; ocamlc_cflags =
         [ "-I/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/include/nolibc/"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ]
     ; ocamlc_cppflags =
         [ "-D_FILE_OFFSET_BITS=64"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/nolibc/include"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/include"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/src"
         ; "-nostdlib"
         ]
     ; ocamlopt_cflags =
         [ "-I/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/include/nolibc/"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ]
     ; ocamlopt_cppflags =
         [ "-D_FILE_OFFSET_BITS=64"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/nolibc/include"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/include"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/src"
         ; "-nostdlib"
         ]
     ; bytecomp_c_compiler =
         [ "x86_64-solo5-none-static-cc"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/include/nolibc/"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-D_FILE_OFFSET_BITS=64"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/nolibc/include"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/include"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/src"
         ; "-nostdlib"
         ]
     ; bytecomp_c_libraries = []
     ; native_c_compiler =
         [ "x86_64-solo5-none-static-cc"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/include/nolibc/"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-O2"
         ; "-fno-strict-aliasing"
         ; "-fwrapv"
         ; "-D_FILE_OFFSET_BITS=64"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/nolibc/include"
         ; "-include"
         ; "_solo5/overrides.h"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/include"
         ; "-I/usr/home/hannes/.opam/tls-no-sexp/.opam-switch/build/ocaml-solo5.0.8.1/openlibm/src"
         ; "-nostdlib"
         ]
     ; native_c_libraries =
         [ "-L/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/lib/nolibc/"
         ; "-lnolibc"
         ; "-lopenlibm"
         ]
     ; native_pack_linker = [ "x86_64-solo5-none-static-ld"; "-r"; "-o" ]
     ; cc_profile = []
     ; architecture = "amd64"
     ; model = "default"
     ; int_size = 63
     ; word_size = 64
     ; system = "unknown"
     ; asm = [ "x86_64-solo5-none-static-cc"; "-c" ]
     ; asm_cfi_supported = true
     ; with_frame_pointers = false
     ; ext_exe = ""
     ; ext_obj = ".o"
     ; ext_asm = ".s"
     ; ext_lib = ".a"
     ; ext_dll = ".so"
     ; os_type = "Unix"
     ; default_executable_name = "a.out"
     ; systhread_supported = false
     ; host = "x86_64-unknown-none"
     ; target = "x86_64-unknown-none"
     ; profiling = false
     ; flambda = false
     ; spacetime = false
     ; safe_string = true
     ; exec_magic_number = "Caml1999X031"
     ; cmi_magic_number = "Caml1999I031"
     ; cmo_magic_number = "Caml1999O031"
     ; cma_magic_number = "Caml1999A031"
     ; cmx_magic_number = "Caml1999Y031"
     ; cmxa_magic_number = "Caml1999Z031"
     ; ast_impl_magic_number = "Caml1999M031"
     ; ast_intf_magic_number = "Caml1999N031"
     ; cmxs_magic_number = "Caml1999D031"
     ; cmt_magic_number = "Caml1999T031"
     ; natdynlink_supported = false
     ; supports_shared_libraries = false
     ; windows_unicode = false
     }
 }
Running[4]: (cd duniverse/lwt/src/core && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/core/dune.ml)
Running[5]: (cd duniverse/lwt/src/domain && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/domain/dune.ml)
Running[6]: (cd duniverse/lwt/src/ppx && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/ppx/dune.ml)
Running[7]: (cd duniverse/lwt/src/react && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/react/dune.ml)
Running[8]: (cd duniverse/lwt/src/unix && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/unix/dune.ml)
Running[9]: (cd duniverse/lwt/src/unix/luv && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/default/duniverse/lwt/src/unix/luv/dune.ml)
Running[10]: (cd duniverse/lwt/src/core && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/core/dune.ml)
Running[11]: (cd duniverse/lwt/src/domain && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/domain/dune.ml)
Running[12]: (cd duniverse/lwt/src/ppx && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/ppx/dune.ml)
Running[13]: (cd duniverse/lwt/src/react && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/react/dune.ml)
Running[14]: (cd duniverse/lwt/src/unix && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/unix/dune.ml)
Running[15]: (cd duniverse/lwt/src/unix/luv && /usr/home/hannes/.opam/tls-no-sexp/bin/ocaml -I +compiler-libs /usr/home/hannes/devel/mirage/tlstunnel/unikernel/_build/.dune/solo5/duniverse/lwt/src/unix/luv/dune.ml)
Actual targets:                 
- alias @@default
Running[16]: (cd _build/solo5 && /usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlopt -w -40 -g -o main.exe duniverse/ocaml-cstruct/lib/cstruct.cmxa -I duniverse/ocaml-cstruct/lib duniverse/logs/src/logs.cmxa duniverse/ocaml-ipaddr/lib/macaddr.cmxa duniverse/domain-name/domain_name.cmxa duniverse/ocaml-ipaddr/lib/ipaddr.cmxa duniverse/arp/src/arp.cmxa duniverse/fmt/src/fmt.cmxa duniverse/bytes/bytes.cmxa duniverse/lwt/src/core/lwt.cmxa duniverse/mirage-net/src/mirage_net.cmxa duniverse/ethernet/src/ethernet.cmxa duniverse/mirage-time/src/mirage_time.cmxa duniverse/duration/duration.cmxa duniverse/arp/mirage/arp_mirage.cmxa duniverse/ptime/src/ptime.cmxa duniverse/gmap/gmap.cmxa duniverse/metrics/src/core/metrics.cmxa duniverse/ocaml-base64/src/base64.cmxa duniverse/ocaml-dns/src/dns.cmxa duniverse/mirage-flow/src/mirage_flow.cmxa duniverse/mirage-tcpip/src/core/tcpip.cmxa duniverse/ocaml-dns/mirage/dns_mirage.cmxa duniverse/eqaf/lib/eqaf.cmxa duniverse/eqaf/lib/eqaf_bigstring.cmxa duniverse/eqaf/lib/eqaf_cstruct.cmxa duniverse/mirage-crypto/src/mirage_crypto.cmxa -I duniverse/mirage-crypto/src duniverse/ocaml-dns/tsig/dns_tsig.cmxa duniverse/Zarith/zarith.cmxa -I duniverse/Zarith duniverse/ocaml-asn1-combinators/src/asn1_combinators.cmxa duniverse/mirage-crypto/rng/mirage_crypto_rng.cmxa duniverse/sexplib0/src/sexplib0.cmxa duniverse/mirage-crypto/pk/mirage_crypto_pk.cmxa duniverse/mirage-crypto/ec/mirage_crypto_ec.cmxa -I duniverse/mirage-crypto/ec duniverse/ocaml-pbkdf/src/pbkdf.cmxa duniverse/ocaml-x509/lib/x509.cmxa duniverse/randomconv/randomconv.cmxa duniverse/ocaml-dns/certify/dns_certify.cmxa duniverse/mirage-random/src/mirage_random.cmxa duniverse/mirage-clock/src/mirage_clock.cmxa duniverse/ocaml-dns/mirage/certify/dns_certify_mirage.cmxa duniverse/mirage-block/src/mirage_block.cmxa duniverse/cmdliner/src/cmdliner.cmxa duniverse/mirage/lib_runtime/functoria/functoria_runtime.cmxa duniverse/mirage/lib_runtime/mirage/mirage_runtime.cmxa duniverse/bheap/binary_heap.cmxa duniverse/metrics/src/lwt/metrics_lwt.cmxa duniverse/mirage-solo5/lib/solo5_os.cmxa -I duniverse/mirage-solo5/lib duniverse/mirage-block-solo5/src/block.cmxa -I duniverse/mirage-block-solo5/src duniverse/parse-argv/src/parse_argv.cmxa duniverse/mirage-bootvar-solo5/lib/bootvar.cmxa duniverse/mirage-clock/solo5/mirage_clock_solo5.cmxa -I duniverse/mirage-clock/solo5 duniverse/mirage-crypto/rng/mirage/mirage_crypto_rng_mirage.cmxa duniverse/mirage-logs/src/mirage_logs.cmxa duniverse/mirage-net-solo5/src/netif.cmxa -I duniverse/mirage-net-solo5/src duniverse/mirage-tcpip/src/tcpip_checksum/tcpip_checksum.cmxa -I duniverse/mirage-tcpip/src/tcpip_checksum duniverse/mirage-tcpip/src/icmp/tcpip_icmpv4.cmxa duniverse/mirage-tcpip/src/udp/tcpip_udpv4.cmxa duniverse/seq/src/seq.cmxa duniverse/psq/src/psq.cmxa duniverse/lru/src/lru.cmxa duniverse/mirage-tcpip/src/ipv4/tcpip_ipv4.cmxa duniverse/ocaml-ipaddr/lib/macaddr_cstruct.cmxa duniverse/ocaml-ipaddr/lib/ipaddr_cstruct.cmxa duniverse/mirage-tcpip/src/ipv6/tcpip_ipv6.cmxa duniverse/lwt-dllist/src/lwt_dllist.cmxa duniverse/mirage-tcpip/src/tcp/tcp.cmxa duniverse/mirage-tcpip/src/stack-direct/tcpip_stack_direct.cmxa duniverse/ocaml-hkdf/hkdf.cmxa duniverse/ocaml-tls/lib/tls.cmxa duniverse/optint/src/optint.cmxa duniverse/mirage-kv/src/mirage_kv.cmxa duniverse/ocaml-tls/mirage/tls_mirage.cmxa manifest.o .main.eobjs/native/dune__exe.cmx .main.eobjs/native/dune__exe__Configuration.cmx .main.eobjs/native/dune__exe__Filesystem.cmx .main.eobjs/native/dune__exe__Key_gen.cmx .main.eobjs/native/dune__exe__Unikernel.cmx .main.eobjs/native/dune__exe__Main.cmx -w -70 -color always -cclib '-z solo5-abi=hvt')
File "dune.build", line 7, characters 7-11:
7 |  (name main)
           ^^^^
Command [16] exited with code 2:
$ (cd _build/solo5 && /usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/bin/ocamlopt -w -40 -g -o main.exe duniverse/ocaml-cstruct/lib/cstruct.cmxa -I duniverse/ocaml-cstruct/lib duniverse/logs/src/logs.cmxa duniverse/ocaml-ipaddr/lib/macaddr.cmxa duniverse/domain-name/domain_name.cmxa duniverse/ocaml-ipaddr/lib/ipaddr.cmxa duniverse/arp/src/arp.cmxa duniverse/fmt/src/fmt.cmxa duniverse/bytes/bytes.cmxa duniverse/lwt/src/core/lwt.cmxa duniverse/mirage-net/src/mirage_net.cmxa duniverse/ethernet/src/ethernet.cmxa duniverse/mirage-time/src/mirage_time.cmxa duniverse/duration/duration.cmxa duniverse/arp/mirage/arp_mirage.cmxa duniverse/ptime/src/ptime.cmxa duniverse/gmap/gmap.cmxa duniverse/metrics/src/core/metrics.cmxa duniverse/ocaml-base64/src/base64.cmxa duniverse/ocaml-dns/src/dns.cmxa duniverse/mirage-flow/src/mirage_flow.cmxa duniverse/mirage-tcpip/src/core/tcpip.cmxa duniverse/ocaml-dns/mirage/dns_mirage.cmxa duniverse/eqaf/lib/eqaf.cmxa duniverse/eqaf/lib/eqaf_bigstring.cmxa duniverse/eqaf/lib/eqaf_cstruct.cmxa duniverse/mirage-crypto/src/mirage_crypto.cmxa -I duniverse/mirage-crypto/src duniverse/ocaml-dns/tsig/dns_tsig.cmxa duniverse/Zarith/zarith.cmxa -I duniverse/Zarith duniverse/ocaml-asn1-combinators/src/asn1_combinators.cmxa duniverse/mirage-crypto/rng/mirage_crypto_rng.cmxa duniverse/sexplib0/src/sexplib0.cmxa duniverse/mirage-crypto/pk/mirage_crypto_pk.cmxa duniverse/mirage-crypto/ec/mirage_crypto_ec.cmxa -I duniverse/mirage-crypto/ec duniverse/ocaml-pbkdf/src/pbkdf.cmxa duniverse/ocaml-x509/lib/x509.cmxa duniverse/randomconv/randomconv.cmxa duniverse/ocaml-dns/certify/dns_certify.cmxa duniverse/mirage-random/src/mirage_random.cmxa duniverse/mirage-clock/src/mirage_clock.cmxa duniverse/ocaml-dns/mirage/certify/dns_certify_mirage.cmxa duniverse/mirage-block/src/mirage_block.cmxa duniverse/cmdliner/src/cmdliner.cmxa duniverse/mirage/lib_runtime/functoria/functoria_runtime.cmxa duniverse/mirage/lib_runtime/mirage/mirage_runtime.cmxa duniverse/bheap/binary_heap.cmxa duniverse/metrics/src/lwt/metrics_lwt.cmxa duniverse/mirage-solo5/lib/solo5_os.cmxa -I duniverse/mirage-solo5/lib duniverse/mirage-block-solo5/src/block.cmxa -I duniverse/mirage-block-solo5/src duniverse/parse-argv/src/parse_argv.cmxa duniverse/mirage-bootvar-solo5/lib/bootvar.cmxa duniverse/mirage-clock/solo5/mirage_clock_solo5.cmxa -I duniverse/mirage-clock/solo5 duniverse/mirage-crypto/rng/mirage/mirage_crypto_rng_mirage.cmxa duniverse/mirage-logs/src/mirage_logs.cmxa duniverse/mirage-net-solo5/src/netif.cmxa -I duniverse/mirage-net-solo5/src duniverse/mirage-tcpip/src/tcpip_checksum/tcpip_checksum.cmxa -I duniverse/mirage-tcpip/src/tcpip_checksum duniverse/mirage-tcpip/src/icmp/tcpip_icmpv4.cmxa duniverse/mirage-tcpip/src/udp/tcpip_udpv4.cmxa duniverse/seq/src/seq.cmxa duniverse/psq/src/psq.cmxa duniverse/lru/src/lru.cmxa duniverse/mirage-tcpip/src/ipv4/tcpip_ipv4.cmxa duniverse/ocaml-ipaddr/lib/macaddr_cstruct.cmxa duniverse/ocaml-ipaddr/lib/ipaddr_cstruct.cmxa duniverse/mirage-tcpip/src/ipv6/tcpip_ipv6.cmxa duniverse/lwt-dllist/src/lwt_dllist.cmxa duniverse/mirage-tcpip/src/tcp/tcp.cmxa duniverse/mirage-tcpip/src/stack-direct/tcpip_stack_direct.cmxa duniverse/ocaml-hkdf/hkdf.cmxa duniverse/ocaml-tls/lib/tls.cmxa duniverse/optint/src/optint.cmxa duniverse/mirage-kv/src/mirage_kv.cmxa duniverse/ocaml-tls/mirage/tls_mirage.cmxa manifest.o .main.eobjs/native/dune__exe.cmx .main.eobjs/native/dune__exe__Configuration.cmx .main.eobjs/native/dune__exe__Filesystem.cmx .main.eobjs/native/dune__exe__Key_gen.cmx .main.eobjs/native/dune__exe__Unikernel.cmx .main.eobjs/native/dune__exe__Main.cmx -w -70 -color always -cclib '-z solo5-abi=hvt')
ld.lld: error: unable to find library -lgmp
cc: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

Furthermore,

[18:43 hannes@neo:unikernel] find duniverse/ocaml-gmp/ | less
duniverse/ocaml-gmp/
duniverse/ocaml-gmp/gmp.opam
duniverse/ocaml-gmp/test
duniverse/ocaml-gmp/test/dune
duniverse/ocaml-gmp/test/test.expected
duniverse/ocaml-gmp/test/dummy_stubs.c
duniverse/ocaml-gmp/test/test.ml
duniverse/ocaml-gmp/test/dummy.ml
duniverse/ocaml-gmp/.gitignore
duniverse/ocaml-gmp/dune-project
duniverse/ocaml-gmp/CHANGES.md
duniverse/ocaml-gmp/COPYING.LESSERv3
duniverse/ocaml-gmp/.ocamlformat
duniverse/ocaml-gmp/dune-workspace.solo5
duniverse/ocaml-gmp/README.md
duniverse/ocaml-gmp/COPYING
duniverse/ocaml-gmp/src
duniverse/ocaml-gmp/src/dune
duniverse/ocaml-gmp/src/gmp-6.2.1.tar.xz
duniverse/ocaml-gmp/src/build.sh.in
duniverse/ocaml-gmp/.github
duniverse/ocaml-gmp/.github/workflows
duniverse/ocaml-gmp/.github/workflows/CI.yml

Hope that helps you to debug. A workaround on my computer is as follows:

[18:54 hannes@neo:unikernel] rm -rf ~/.cache/dune/
[18:55 hannes@neo:unikernel] git clean -dfx
Removing unikernel/Makefile
Removing unikernel/_build/
Removing unikernel/dist/
Removing unikernel/dune
Removing unikernel/dune-project
Removing unikernel/dune-workspace
Removing unikernel/dune.build
Removing unikernel/dune.config
git Removing unikernel/duniverse/
Removing unikernel/mirage/
[18:55 hannes@neo:unikernel] mirage configure -t hvt
gm[18:55 hannes@neo:unikernel] gmake lock pull build
gmake[1]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
gmake[2]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
e[2musing overlay repository mirage: [opam-overlays, mirage-overlays] e[0m
[opam-overlays] no changes from git+https://github.com/dune-universe/opam-overlays.git
[NOTE] Repository opam-overlays has been added to the selections of switch tls-no-sexp only.
       Run `opam repository add opam-overlays --all-switches|--set-default' to use it in all existing
       switches, or in newly created switches, respectively.

[mirage-overlays] no changes from git+https://github.com/dune-universe/mirage-opam-overlays.git
[NOTE] Repository mirage-overlays has been added to the selections of switch tls-no-sexp only.
       Run `opam repository add mirage-overlays --all-switches|--set-default' to use it in all existing
       switches, or in newly created switches, respectively.

gmake[2]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
 ↳ generate lockfile for monorepo dependencies
==> Using 1 locally scanned package as the target.
[WARNING] Unknown variable "ocaml-system:version"
[WARNING] Unknown variable "ocaml-base-compiler:version"
[WARNING] Unknown variable "ocaml-variants:version"
[WARNING] Unknown variable "ocaml-system:version"
[WARNING] Unknown variable "ocaml-base-compiler:version"
[WARNING] Unknown variable "ocaml-variants:version"
==> Found 100 opam dependencies for the target package.
==> Querying opam database for their metadata and Dune compatibility.
==> Calculating exact pins for each of them.
==> Wrote lockfile with 52 entries to mirage/tlstunnel-hvt.opam.locked. You can now run opam monorepo pull to fetch their sources.
gmake[2]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
e[2mremoving overlay repository [opam-overlays, mirage-overlays]e[0m
Repositories removed from the selections of switch tls-no-sexp. Use '--all' to forget about them altogether.
Repositories removed from the selections of switch tls-no-sexp. Use '--all' to forget about them altogether.
gmake[2]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
gmake[1]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel'
 ↳ fetch monorepo dependencies in the duniverse folder
==> Using lockfile mirage/tlstunnel-hvt.opam.locked
Successfully pulled 52/52 repositories
mirage build -f config.ml
gmake[1]: Entering directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel/_build/solo5/duniverse/mirage-solo5/lib/bindings'
ocamlfind -toolchain solo5 ocamlopt    -c -o clock_stubs.o clock_stubs.c
ocamlfind -toolchain solo5 ocamlopt    -c -o mm_stubs.o mm_stubs.c
ocamlfind -toolchain solo5 ocamlopt    -c -o main.o main.c
ar r libmirage-solo5_bindings.a clock_stubs.o mm_stubs.o main.o
ar: warning: creating libmirage-solo5_bindings.a
gmake[1]: Leaving directory '/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel/_build/solo5/duniverse/mirage-solo5/lib/bindings'
Done: 77% (1388/1781, 393 left) (jobs: 4)ELF interpreter /nonexistent/solo5/ not found, error 2
Done: 77% (1388/1781, 393 left) (jobs: 4)ELF interpreter /nonexistent/solo5/ not found, error 2
configure: WARNING: using cross tools not prefixed with host triplet
configure: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok
binary ocaml: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary ocamlc: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary ocamldep: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary ocamlmklib: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary ocamldoc: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary x86_64-solo5-none-static-cc: found in /usr/home/hannes/.opam/tls-no-sexp/bin
binary ocamlopt: found in /usr/home/hannes/.opam/tls-no-sexp/bin
checking compilation with x86_64-solo5-none-static-cc -I/usr/home/hannes/.opam/tls-no-sexp/solo5-sysroot/include/nolibc/ -include _solo5/overrides.h -O2 -fno-strict-aliasing -fwrapv -I/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel/_build/solo5/duniverse/Zarith/../../../install/solo5/lib/gmp/: working
include caml/mlvalues.h: found
library dynlink.cmxa: found
binary ocamlfind: found in /usr/home/hannes/.opam/tls-no-sexp/bin
OCaml's word size is 64
binary uname: found in /usr/bin
include gmp.h: found
library gmp: found
OCaml supports -bin-annot to produce documentation

detected configuration:

  native-code:          yes
  dynamic linking:      yes
  defines:              -DHAS_GMP 
  libraries:            -L/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel/_build/solo5/duniverse/Zarith/../../../install/solo5/lib/gmp/ -lgmp
  C options:            -I/usr/home/hannes/devel/mirage/tlstunnel-fresh/unikernel/_build/solo5/duniverse/Zarith/../../../install/solo5/lib/gmp/
  installation path:    /usr/home/hannes/.opam/tls-no-sexp/lib
  installation method   findlib

configuration successful!
now type "make" to build
then type "make install" or "sudo make install" to install
[18:59 hannes@neo:unikernel]

And now, the artifact I intended to build, dist/tlstunnel.hvt exists and works.

Happy to provide further information on request. Since I removed the "dune cache", I can't tell you what was in there. :/

@hannesm
Copy link
Member Author

hannesm commented Dec 5, 2023

Looks like there's no interest in this issue, closing. My fix was to remove the dune cache, which seems to fail the main property a cache should have (consistency). Have a nice day.

@hannesm hannesm closed this as completed Dec 5, 2023
@rgrinberg
Copy link
Member

There's interest, but the issue is rather complex. I hope the team will get to work on the cache in the near future, but I can't guarantee we'll be able to address this issue in a timely manner.

@hannesm
Copy link
Member Author

hannesm commented Dec 5, 2023

Thanks for your kind words @rgrinberg. For me, this issue is not pressing since I found a very nice workaround. Plus, as discussed in March 2020 in Marrakech, I have other doubts about the "dune cache" consistency. So, for me it is just the best path to disable it (as I did, and never ran into issues again). That it consumes unbounded amount of disk space is also concerning -- but as said, I've no incentives to open issues or pull requests for "dune cache".

Also, it seems to work fine for enough other people - so you should care about other issues that are more relevant / affect more people.

@rgrinberg
Copy link
Member

The cache at its current state is indeed problematic. I suppose that's why we do not enable it by default. We do appreciate bug reports from early adopters, but there's no guarantees the feature is usable. I'll let you know once the cache is in a better state, and perhaps you can revisit your experiment with it.

@hannesm
Copy link
Member Author

hannesm commented Dec 5, 2023

Thanks again Rudi for your words.

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