TikZ not working on arm64
felixvanoost opened this issue Β· comments
TikZ returns an Exec format error (exit code 126)
when running on arm64
. I thought I had checked all the libraries before opening #1487, but this doesn't seem to have been the case... π
After some digging I realised that the kroki-builder-dvisvgm
stage doesn't install the correct cross-compiler tools to actually build the arm64
binary from an amd64
host. From v0.23.0, platform=arm64
, we can see that the binary type is always x86-64
:
/usr/bin/dvisvgm: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=82a54975c5565c66b9eb969f1656f7aea2b1afd1, for GNU/Linux 3.2.0, with debug_info, not stripped
This issue hasn't shown up in CI because the workflows only use native builds that don't require cross-compilation. There are 3 ways to resolve this:
- Attempt to fix cross-compilation. I've already spent some time on this, but I haven't been able to make it work yet. There are 4 possible uses cases to handle as well, making it quite messy.
- Revert to QEMU. Go back to using emulation for the
kroki-builder-dvisvgm
stage, which produces the correct result but takes forever to build. This wouldn't affect the CI normally because they're all running natively, but it would make therelease
workflow take much longer than it currently does. - Build
dvisvgm
binaries in a separate Yuzutech repo. This could be done with the native Arm runner.
I can work on a fix for either 1 or 2 if needed.
@ggrossetie any thoughts on the preferred approach?
Hey!
I think we should opt for the 3rd solution. I already have an ARM64 runner so I can configure it to build the dvisvgm
binary.
@ggrossetie I saw the announcement a couple of months ago; would you consider joining the beta? Looks like it's only available to business accounts for now.
Is there anything I can do suport this issue?
I saw the announcement a couple of months ago; would you consider joining the beta? Looks like it's only available to business accounts for now.
I thought it was GA :/
@felixvanoost Do you have a repository that build dvisvgm
binaries? If so, we can move it to the yuzutech organization and I can setup a build on my ARM64 runner.
@ggrossetie I don't have one currently but can create one if it helps. The kroki-builder-dvisvgm
code in the existing Dockerfile works for both amd64
and arm64
as long as each binary is built using the same build and target architecture. The part that isn't working is cross-compilation.
FROM --platform=$BUILDPLATFORM ubuntu:jammy AS kroki-builder-dvisvgm
RUN apt-get update && apt-get install --no-install-recommends --yes \
build-essential \
pkg-config \
libclipper-dev \
libfreetype-dev \
libkpathsea-dev \
ghostscript \
libssl-dev \
zlib1g-dev \
curl \
ca-certificates
ARG DVISVGM_VERSION=3.0.4
ARG BUILDARCH
ARG TARGETARCH
RUN curl -LO https://github.com/mgieseki/dvisvgm/releases/download/$DVISVGM_VERSION/dvisvgm-$DVISVGM_VERSION.tar.gz && \
tar xf dvisvgm-$DVISVGM_VERSION.tar.gz && \
cd dvisvgm-$DVISVGM_VERSION && \
case $BUILDARCH in \
"amd64") MAKE_BUILD_ARCH=x86_64 ;; \
"arm64") MAKE_BUILD_ARCH=aarch64 ;; \
*) MAKE_BUILD_ARCH=$BUILDARCH ;; \
esac && \
case $TARGETARCH in \
"amd64") MAKE_TARGET_ARCH=x86_64 ;; \
"arm64") MAKE_TARGET_ARCH=aarch64 ;; \
*) MAKE_TARGET_ARCH=$TARGETARCH ;; \
esac && \
./configure --enable-bundled-libs --build $MAKE_BUILD_ARCH-linux-gnu --host $MAKE_TARGET_ARCH-linux-gnu && \
make && \
make install
In short, you should be able to copy this code directly to a new repo and set up a workflow that builds one dvisvgm
binary on an arm64
host and the other on an amd64
host.
We know this will work because the Kroki nightly
CI worflow that runs on an arm64
host builds and passes all the tests without issues. This is also why I didn't catch the issue earlier, because the main
and nightly
workflows run on native hosts but the release
workflow cross-compiles to arm64
from an amd64
host.
Update: It turns out that up-to-date dvisvgm
binaries are available via apt
for Ubuntu 24.04 (Noble), which will become the new LTS release in about 3 weeks:
https://packages.ubuntu.com/noble/dvisvgm
I can open a PR for the change once an updated version of the eclipse-temurin
image is released.
Yes that would be awesome, thanks ππ»