Repository navigation
Closed
Labels
Description
What did you do?
Tried to compile from source with cpython main branch
What did you expect to happen?
It to compile.
What actually happened?
Failed to compile.
What are your OS, Python and Pillow versions?
- OS: arch, gcc (gcc (GCC) 16.2.1 20260810) or clang (clang version 23.1.4)
- Python: main branch (v3.16.0a1-393-ga9049ee4fb6)
- Pillow: main branch (1.7.6-21484-g5e898683d)
In file included from src/libImaging/Imaging.h:13,
from src/libImaging/Effects.c:18:
src/libImaging/ImPlatform.h:15:2: error: #error Sorry, this library requires support for ANSI prototypes.
15 | #error Sorry, this library requires support for ANSI prototypes.
| ^~~~~
In file included from src/libImaging/Imaging.h:13,
from src/libImaging/Draw.c:35:
src/libImaging/ImPlatform.h:15:2: error: #error Sorry, this library requires support for ANSI prototypes.
15 | #error Sorry, this library requires support for ANSI prototypes.
| ^~~~~
error: Command ['gcc', '-DCYTHON_FAST_THREAD_STATE=0', '-fPIC', '-DHAVE_LIBTIFF', '-DHAVE_LIBJPEG', '-DHAVE_OPENJPEG', '-DHAVE_LIBZ', '-DHAVE_LIBIMAGEQUANT', '-DHAVE_XCB', '-DPILLOW_VERSION="13.1.0.dev0"', '-I/usr/include/freetype2', '-I/usr/include/openjpeg-2.5', '-I/usr/include', '-I/usr/include/webp', '-I/usr/include/libpng16', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/glib-2.0/include', '-I/usr/include/sysprof-6', '-I/usr/include/fribidi', '-I/home/tcaswell/.virtualenvs/cp316/include', '-I/usr/local/include', '-I/home/tcaswell/.virtualenvs/cp316/include', '-I/home/tcaswell/.pybuild/cp316/include/python3.16', '-c', 'src/libImaging/ColorLUT.c', '-o', 'build/temp.linux-x86_64-cpython-316/src/libImaging/ColorLUT.o'] returned non-zero exit status 1.
[end of output]
error: Command ['clang', '-DCYTHON_FAST_THREAD_STATE=0', '-fPIC', '-DHAVE_LIBTIFF', '-DHAVE_LIBJPEG', '-DHAVE_OPENJPEG', '-DHAVE_LIBZ', '-DHAVE_LIBIMAGEQUANT', '-DHAVE_XCB', '-DPILLOW_VERSION="13.1.0.dev0"', '-I/usr/include/freetype2', '-I/usr/include/openjpeg-2.5', '-I/usr/include', '-I/usr/include/webp', '-I/usr/include/libpng16', '-I/usr/include/harfbuzz', '-I/usr/include/glib-2.0', '-I/usr/lib/glib-2.0/include', '-I/usr/include/sysprof-6', '-I/usr/include/fribidi', '-I/home/tcaswell/.virtualenvs/cp316-clang/include', '-I/usr/local/include', '-I/home/tcaswell/.virtualenvs/cp316-clang/include', '-I/home/tcaswell/.pybuild/cp316-clang/include/python3.16', '-c', 'src/libImaging/Arrow.c', '-o', 'build/temp.linux-x86_64-cpython-316/src/libImaging/Arrow.o'] returned non-zero exit status 1.
src/_imaging.c:1324:84: warning: implicit conversion from enumeration type 'const ModeID' to different enumeration type 'RawModeID' [-Wimplicit-enum-enum-cast]
1324 | const RawModeID rawmode = rawmode_name != NULL ? findRawModeID(rawmode_name) : mode;
| ~~~~~~~ ^~~~
1 error generated.
In file included from src/libImaging/ColorLUT.c:1:
In file included from src/libImaging/Imaging.h:13:
src/libImaging/ImPlatform.h:15:2: error: Sorry, this library requires support for ANSI prototypes.
15 | #error Sorry, this library requires support for ANSI prototypes.
| ^
1 error generated.
1 error generated.
1 warning and 1 error generated.
In file included from src/libImaging/Draw.c:35:
In file included from src/libImaging/Imaging.h:13:
src/libImaging/ImPlatform.h:15:2: error: Sorry, this library requires support for ANSI prototypes.
15 | #error Sorry, this library requires support for ANSI prototypes.
| ^
1 error generated.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
The source of the problem is that upstream removed the HAVE_PROTOTYPES macro in python/cpython#159513 .
This minimal fix is:
diff --git a/src/libImaging/ImPlatform.h b/src/libImaging/ImPlatform.h
index a800d8278..29c4425e4 100644
--- a/src/libImaging/ImPlatform.h
+++ b/src/libImaging/ImPlatform.h
@@ -11,9 +11,6 @@
#include <Python.h>
/* Check that we have an ANSI compliant compiler */
-#ifndef HAVE_PROTOTYPES
-#error Sorry, this library requires support for ANSI prototypes.
-#endif
#ifndef STDC_HEADERS
#error Sorry, this library requires ANSI header files.
#endifbut I am not sure the exact intersection of when Python's minimum C is high enough that this is unneeded and and the support window of old Python for Pillow intersect to make this safe to just drop or if it requires some version gating on CPython version.
I also leave to @hugovk if there is a case to be made to revert this upstream or just deal with it here.
Activity
hugovk commentedon Oct 26, 2026
This has been around since the earliest copy of PIL I've found, from 1998 :)
https://github.com/hugovk/PIL/blob/0.3b1/libImaging/ImPlatform.h#L16
HAVE_PROTOTYPESandSTDC_HEADERSwere set by CPython's configure script to confirm the compiler supports C89 features (function prototypes and the standard headers). But C99 is already the minimum Pillow needs:And every Python we support (3.11+) requires C11 (which is why CPython dropped the check). So we can drop these checks for C89 features after ~28 years :)
tacaswell commentedon Oct 26, 2026
It is amazing how long things can just float along!
[-]cp316 drops required macro for Pyllow to compile[/-][+]cp316 drops required macro for Pillow to compile[/+]