Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wheel for ARM musllinux aarch64 #3541

Open
quinnjr opened this issue Jun 1, 2024 · 7 comments
Open

Add Wheel for ARM musllinux aarch64 #3541

quinnjr opened this issue Jun 1, 2024 · 7 comments

Comments

@quinnjr
Copy link

quinnjr commented Jun 1, 2024

Is your feature request related to a problem? Please describe.
Currently, this library takes forever to compile on Alpine Linux for Docker containers running on ARM. Please cross-compile the library for arm64 with support for Alpine Linux.

Describe the solution you'd like
A new wheel is added that installs the library for Alpine Linux without burdensome compilation.

Describe alternatives you've considered
Alternatively, Alpine Linux has MuPDF as an installable library. Instead, use the system library instead of downloading it as an addition of the install.

@quinnjr quinnjr changed the title Add Wheel for ARM Alpine Linux Add Wheel for ARM aarch64 Jun 4, 2024
@julian-smith-artifex-com
Copy link
Collaborator

[Making PyMuPDF use an installed MuPDF is non-trivial because we require MuPDF's Python bindings, which are probably not installed.]

I have an experimental PyMuPDF musllinux wheel at: http://ghostscript.com/~julian/PyMuPDF-1.24.5-cp312-none-musllinux_1_2_x86_64.whl

I've no idea whether it will work on Alpine Linux, but if you could try it out that would be appreciated. For example:

wget http://ghostscript.com/~julian/PyMuPDF-1.24.5-cp312-none-musllinux_1_2_x86_64.whl
pip install PyMuPDF-1.24.5-cp312-none-musllinux_1_2_x86_64.whl

[I can build for a different Python version if required.]

@julian-smith-artifex-com
Copy link
Collaborator

Apologies, the wheel above is for x86_64, not aarch64.

Unfortunately building for musllinux aarch64 on Github does not work because the Python libclang package appears to be broken - it cannot find libclang.so at runtime.

If you have a working build (even if very slow), could you give details of the system?

@quinnjr
Copy link
Author

quinnjr commented Jun 6, 2024

I'm currently running the following Docker container and copying the completed wheel out of it for install. Haven't had much time recently to test full compatibility due to work crunch (not detecting its building for musl linux).

FROM --platform=arm64 alpine:latest

RUN apk update && apk add python3 py3-pip py3-wheel musl-dev jpeg-dev zlib-dev freetype-dev clang clang-dev llvm m4 cmake python3-dev build-base swig

ENV VERSION=1.24.5

WORKDIR /tmp

RUN <<EOF
  pip install --break-system-packages libclang
  wget https://github.com/pymupdf/PyMuPDF/archive/refs/tags/$VERSION.tar.gz
  tar -xvf $VERSION.tar.gz
  cd PyMuPDF-$VERSION
  PYMUPDF_SETUP_MUPDF_TESSERACT=0 python3 setup.py bdist_wheel
EOF

WORKDIR /project
docker build -t pymupdf .
docker run -v $(pwd):/project -it pymupdf

cp /tmp/PyMuPDF-1.24.5/dist/PyMuPDF-1.24.5-cp312-none-linux_aarch64.whl /project

@julian-smith-artifex-com
Copy link
Collaborator

Do you know why this uses --break-system-packages in the command pip install --break-system-packages libclang?

This looks like it might be working around the problem that i'm seeing.

@quinnjr
Copy link
Author

quinnjr commented Jun 8, 2024 via email

@julian-smith-artifex-com julian-smith-artifex-com changed the title Add Wheel for ARM aarch64 Add Wheel for ARM musllinux aarch64 Jun 26, 2024
@julian-smith-artifex-com
Copy link
Collaborator

[Apologies for delay here.]

I don't want to special-case musl-aarch64 builds, so for now we'll have to wait until libclang adds support for musl-aarch64.

@quinnjr
Copy link
Author

quinnjr commented Aug 30, 2024

--target=aarch64-linux-musl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants