kjarosh / latex-docker

A set of lightweight Docker images for building LaTeX documents
MIT License
37 stars 4 forks source link

Please provide ARMv8 images #13

Open sdavids opened 2 months ago

sdavids commented 2 months ago

Apple uses ARM in Macs since 2020.

$ sw_vers
ProductName:            macOS
ProductVersion:         14.6.1
BuildVersion:           23G93
$ uname -m
arm64
$ docker --version
Docker version 27.1.1, build 6312585

$ docker run --rm -v "$PWD:/src" -w /src -u "$UID:$GID" kjarosh/latex:2024.3 latexmk -pdf -output-directory=out main.tex
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
...

https://tug.org/texlive/doc.html#platforms

aarch64-linux | GNU/Linux on ARM64

https://github.com/docker-library/official-images#architectures-other-than-amd64

ARMv8 64-bit (arm64v8)

https://hub.docker.com/_/alpine

arm64v8


https://docs.docker.com/build/building/multi-platform/

https://docs.docker.com/reference/cli/docker/buildx/build/#platform

sdavids commented 2 months ago

A workaround is to add --platform=linux/amd64:

docker run --platform=linux/amd64 ... kjarosh/latex:2024.3 ...

That needs Rosetta 2 to be installed and enabled in Docker though.

kjarosh commented 2 months ago

You're right that both TeXLive and Alpine provide aarch64 versions, but the problem is that TeXLive does not provide aarch64 version with musl (which Alpine uses). The link to tug.org you posted (https://tug.org/texlive/doc.html#platforms) lists x86_64 as the only architecture with musl support.

So the options are currently to either:

  1. do not use Alpine and use something with glibc, which would basically require a full rewrite of the image increasing its size,
  2. use something different than Alpine for aarch64 images only, which would be weird,
  3. somehow make TeXLive work with aarch64 and musl, that will probably require building TeXLive from sources and will make that support unofficial (assuming it even works).

To be honest building TeXLive from sources sounds interesting, but is a major feature to implement.

kjarosh commented 1 month ago

I'm thinking the easiest and cleanest way of providing texlive on Alpine aarch64 would be writing a custom APKBUILD for texlive and building it. There's an existing APKBUILD for texlive (https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/texlive) but I cannot use it in any way as it's not licensed.