-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Description
The PIL._imagingmath extension module fails to load on some systems due to missing linkage against the math library (libm). This causes undefined symbol errors for mathematical functions like fmod, powf, and pow.
bash[./lib/python3.12/site-packages/PIL/_imagingmath.cpython-312-aarch64-linux-gnu.so]:
linux-vdso.so.1 (0x0000ffff9f92d000)
libc.so.6 => /lib64/libc.so.6 (0x0000ffff9f6dc000)
/lib/ld-linux-aarch64.so.1 (0x0000ffff9f8e0000)
undefined symbol: fmod (./lib/python3.12/site-packages/PIL/_imagingmath.cpython-312-aarch64-linux-gnu.so)
undefined symbol: powf (./lib/python3.12/site-packages/PIL/_imagingmath.cpython-312-aarch64-linux-gnu.so)
undefined symbol: pow (./lib/python3.12/site-packages/PIL/_imagingmath.cpython-312-aarch64-linux-gnu.so)Workaround is to use a sed patch to explicitly link the math library:
sed -i 's/Extension("PIL\._imagingmath", \["src\/_imagingmath\.c"\]),/Extension("PIL._imagingmath", ["src\/_imagingmath.c"], libraries=["m"]),/' "./setup.py"Environment
Platform: Amz Linux 2023
Python version: 3.12
Architecture: Aarch64
Pillow: 12.1.0
root@a2f52c62c5cf Pillow-12.1.0 # python3 -m PIL --report
--------------------------------------------------------------------
Pillow 12.1.0
Python 3.12.7 (main, Nov 22 2024, 15:13:20) [Clang 20.0.0git ]
--------------------------------------------------------------------
Python executable is /usr/local/bin/python3
System Python files loaded from /usr/local
--------------------------------------------------------------------
Python Pillow modules loaded from /usr/local/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from /usr/local/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 12.1.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.3
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
*** AVIF support not installed
--- JPEG support ok, compiled for libjpeg-turbo 3.0.90
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1.zlib-ng, compiled for zlib-ng 2.2.2
--- LIBTIFF support ok, loaded 4.7.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.2
*** LIBIMAGEQUANT (Quantization method) support not installed
*** XCB (X protocol) support not installed
--------------------------------------------------------------------
root@a2f52c62c5cf Pillow-12.1.0 #