Page MenuHomeVyOS Platform

Unable to build for ocaml/dune for armhf on docker and chroot
Closed, WontfixPublicENHANCEMENT

Description

For quite som time i've tried to build ocaml/dune (required for building the docker image) using armhf on qemu and pi4.

The process failes with :

#=== ERROR while compiling dune.1.11.0 ========================================#
# context     2.0.0~rc3 | linux/arm32 | ocaml-base-compiler.4.07.0 | https://opam.ocaml.org#63faea6c
# path        /opt/opam/4.07.0/.opam-switch/build/dune.1.11.0
# command     /opt/opam/4.07.0/.opam-switch/build/dune.1.11.0/./boot.exe --release -j 3
# exit-code   1
# env-file    /opt/opam/log/dune-7008-58a9f1.env
# output-file /opt/opam/log/dune-7008-58a9f1.out
### output ###
# [...]
# File "caml_startup", line 1:
# Error: Error during linking
# -> required by src/ocaml-syntax-shims/pp.exe
# -> required by install bin/ocaml-syntax-shims
# -> required by bin/.merlin
# -> required by bin/.merlin-exists
# -> required by bin/.main.objs/byte/main.cmi
# -> required by bin/.main.objs/native/main.cmx
# -> required by bin/main.a
# -> required by bin/main/main_dune.exe
# -> required by install bin/dune
# -> required by dune.install

output file: https://pastebin.com/4krEV76k

this output is from a chroot, but it also failes on docker.

example compacted dockerfile to reproduce:

FROM multiarch/debian-debootstrap:armhf-buster-slim
#FROM multiarch/debian-debootstrap:arm64-buster-slim
LABEL authors="VyOS Maintainers <maintainers@vyos.io>"
ENV DEBIAN_FRONTEND noninteractive
RUN echo "dash dash/sh boolean false" | debconf-set-selections && dpkg-reconfigure dash
RUN apt-get update && apt-get install -y dialog apt-utils locales
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
ENV LANG en_US.utf8
RUN apt-get update && apt-get install -y vim git curl make sudo devscripts autoconf automake lsb-release libtool pkg-config
#Apply fix for https in curl
RUN echo "cacert=/etc/ssl/certs/ca-certificates.crt" >> ~/.curlrc
# Building libvyosconf requires a full configured OPAM/OCaml setup
RUN apt-get update && apt-get install -y libffi-dev libpcre3-dev
RUN curl https://raw.githubusercontent.com/ocaml/opam/2.0.2/shell/install.sh --output /tmp/opam_install.sh && \
    sed -i 's/read BINDIR/BINDIR=""/' /tmp/opam_install.sh && sh /tmp/opam_install.sh && \
    opam init --root=/opt/opam --comp=4.07.0 --disable-sandboxing
RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y oasis
RUN eval $(opam env --root=/opt/opam --set-root) && opam install -y dune

To build for different env's replace the FROM statement in the Dockerfile
This is tested on these env's:

  • Docker on x86-64 - Works
  • Docker on Qemu-static for armhf - Fails
  • Docker on Qemu-static for arm64 - Works
  • Natively on raspbian buster (armhf) - Works
  • Docker on raspbian running armhf - Fails
  • chroot on raspbian running armhf - Fails
  • Docker on Qemu-static for armhf with jessie base - Works

This is also tested using a buster chroot (schroot) on a pi4 with raspbian.

For me it looks like it failes whenever i try to build using anything other than real-root on real-arch when building and it only occurs on buster base images. whenever i try to build inside docker or chroot it failes.
building on jessie as a base image on the other hand works quite well and i've never seen the issue there.
Also building for x86-64 or arm64 works like a charm.

Compilation is tested using ocaml 4.07.0, 4.07.1 and 4.08.0 all with the same result

Details

Version
-

Event Timeline

runar triaged this task as Normal priority.

I've also tested this on the newly released dune1.11.1 with the same result

hagbard claimed this task.
hagbard subscribed.

For now, it has been decided not to support arm officially, due to lack of resources.