D2.2 -- MVP Alpha (UPSYCLE)

Well, well, well…

So I embarked into setting up the following:

Hostname OS Ocaml version Status
upsycle-mr-a.dream.public.cat NixOS 21.05 4.12.0 :negative_squared_cross_mark: boots fine now…
upsycle-mr-b.dream.public.cat Alpine 3.14 4.12.0r0 :negative_squared_cross_mark: builds fine! But breaks at runtime
upsycle-mr-c.dream.public.cat Debian 11 4.11.1 :white_check_mark: works fine!

As you can see, it’s a we’re doing disaster recovery. I wonder how you manage to make a solid work with OCaml…

NixOS on Hetzner Cloud

Really puzzles me. This is the one that should be straightforward, yet something goes wrong and I have no clue (yet). Once installed, I expect the build (from nix.flakes) to run smoothly.

I figured a way to build a NixOS VM on the Hetzner Cloud and could install ocaml-seaboar with the nix flakes, but then ocaml-conduit-dream is not building correctly yet: I’m missing dependencies, opam install . complains about missing make m4 cc and nix-env -iA nixos.make does not work. Meh. I’ll have a look tomorrow.

Alpine Linux

Apparently MUSL is not playing nice with OCaml. I updated the README with dependencies to build on Alpine Linux 3.14.

upsycle-mr-b:~/dream-upsycle-mr$ ./bin/run-msg-router b
٭ set-conduit-backend ()
٭ No conduit backend chosen, defaulting to ocaml-tls
[ env ] CONDUIT_TLS native
٭ [ chdir ] /home/dream/dream-upsycle-mr/bin/..
٭ go (b)
٭ dune exec --display quiet -- upsycle-router/bin/message_router.exe --config /home/dream/dream-upsycle-mr/bin/../conf/config-message-router-b.yaml
    ocamlopt upsycle-router/bin/message_router.exe (exit 2)

[...]

/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /home/dream/.opam/ocaml-system/lib/stdint/libstdint_stubs.a(uint48_conv.o): in function `uint48_of_uint128':
/home/dream/.opam/ocaml-system/.opam-switch/build/stdint.0.7.0/_build/default/lib/uint48_conv.c:172: undefined reference to `get_uint128'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /home/dream/.opam/ocaml-system/lib/stdint/libstdint_stubs.a(uint56_conv.o): in function `uint56_of_int128':
/home/dream/.opam/ocaml-system/.opam-switch/build/stdint.0.7.0/_build/default/lib/uint8_conv.c:172: undefined reference to `get_uint128'
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

Debian 11

Since this is the most stable, I’m trying to get this running first. I still hope that ocaml v4.11.0 remains the minimum target, and did not move upwards.

https://gitlab.com/public.dream/upsycle/message-router/-/issues/3

previously broken details

I’m adding system packages as errors go. ocaml-seaboar builds nicely. ocaml-conduit-dream currently breaks:

dream@upsycle-mr-c:~/ocaml-conduit-dream$ opam install .
[conduit-async-dream.4.0.1-6] no changes from git+file:///home/dream/ocaml-conduit-dream#master
[conduit-dream.4.0.1-6] no changes from git+file:///home/dream/ocaml-conduit-dream#master
[conduit-lwt-dream.4.0.1-6] no changes from git+file:///home/dream/ocaml-conduit-dream#master
[conduit-lwt-unix-dream.4.0.1-6] no changes from git+file:///home/dream/ocaml-conduit-dream#master
[conduit-mirage-dream.4.0.1-6] no changes from git+file:///home/dream/ocaml-conduit-dream#master
[NOTE] Package conduit-async-dream is already installed (current version is 4.0.1-6).
[NOTE] Package conduit-dream is already installed (current version is 4.0.1-6).
[NOTE] Package conduit-lwt-dream is already installed (current version is 4.0.1-6).
[NOTE] Package conduit-mirage-dream is already installed (current version is 4.0.1-6).
The following actions will be performed:
  ∗ install conduit-lwt-unix-dream 4.0.1-6*
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of conduit-lwt-unix-dream failed at "/home/dream/.opam/opam-init/hooks/sandbox.sh build dune build -p conduit-lwt-unix-dream -j 1".

#=== ERROR while compiling conduit-lwt-unix-dream.4.0.1-6 =====================#
# context     2.0.8 | linux/x86_64 | ocaml-system.4.11.1 | pinned(git+file:///home/dream/ocaml-conduit-dream#master#cc40f1a9)
# path        ~/.opam/default/.opam-switch/build/conduit-lwt-unix-dream.4.0.1-6
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p conduit-lwt-unix-dream -j 1
# exit-code   1
# env-file    ~/.opam/log/conduit-lwt-unix-dream-59981-90b366.env
# output-file ~/.opam/log/conduit-lwt-unix-dream-59981-90b366.out
### output ###
# 296 |   >>= fun (fd, ic, oc, info) ->
# [...]
# Error: This pattern matches values of type 'a * 'b * 'c * 'd
#        but a pattern was expected which matches values of type
#          Lwt_unix.file_descr * Lwt_io.input_channel * Lwt_io.output_channel
#     ocamlopt src/conduit-lwt-unix/.conduit_lwt_unix.objs/native/conduit_lwt_unix.{cmx,o} (exit 2)
# (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -I src/conduit-lwt-unix/.conduit_lwt_unix.objs/byte -I src/conduit-lwt-unix/.conduit_lwt_unix.objs/native -I /home/dream/.opam/default/lib/angstrom -I /home/dream/.opam/default/lib/asn1-combinators -I /home/dream/.opa
m/default/lib/astring -I /home/dream/.opam/default/lib/base/caml -I /home/dream/.opam/default/lib/base64 -I /home/dream/.opa[...]
# File "src/conduit-lwt-unix/conduit_lwt_unix.ml", line 296, characters 10-28:
# 296 |   >>= fun (fd, ic, oc, info) ->
#                 ^^^^^^^^^^^^^^^^^^
# Error: This pattern matches values of type 'a * 'b * 'c * 'd
#        but a pattern was expected which matches values of type
#          Lwt_unix.file_descr * Lwt_io.input_channel * Lwt_io.output_channel



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build conduit-lwt-unix-dream 4.0.1-6
└─
╶─ No changes have been performed

I’ll have a look after lunch