I have the following setup: Github Actions, Ubuntu 22.04 image with Debian bullseye in a foreign chroot jail (as described in https://www.hellion.org.uk/blog/posts/foreign-chroots-with-schroot-and-qemu/).
I set up OCaml as follows:
sudo apt-get install opam
opam init -y --disable-sandboxing
eval $(opam config env)
opam switch create . ocaml-base-compiler.4.14.0 -y
eval $(opam config env)
opam install opam-depext
If I run this directly in the Ubuntu 22.04 image, this takes under 10 minutes. In the foreign chroot, this process takes some 75–90 minutes. apt and opam init, as well as opam install opam-depext each just take a few minutes, but opam switch create takes over an hour. Most of that time is spent in the first of two Processing actions stages, followed by the following output:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed ocaml-base-compiler.4.14.1
∗ installed ocaml-config.2
∗ installed ocaml.4.14.1
∗ installed ocaml-options-vanilla.1
Done.
After doing some more tests, behavior is similar with other guest architectures, namely arm64, ppc64el and s390x. On mipsel and mips64el, opam switch create aborted after some 40–45 minutes due to lack of native compiler support. The odd one out was i386 – notably the 32-bit flavor of the host architecture.
I understand that a virtualization layer, especially a cross-architecture one, slows things down somewhat, but this looks quite extreme to me. (A while ago I did something similar in a full VM, also arm on amd64. While I do not remember the exact times, I would say it was closer to 10 than to 75 minutes.)
Any ideas what is slowing down my setup, or where I should start looking to find out?