cp316 drops required macro for Pillow to compile
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- build-system
调研方向
Start with src/libImaging/ImPlatform.h and inspect the HAVE_PROTOTYPES check alongside Pillow’s supported Python versions and C requirements. Reproduce the build failure using the reported CPython main branch and GCC or Clang, then check compatibility across the support window. Done when Pillow builds on CPython main without breaking its supported older Python versions.
由索引模型根据 Issue 内容生成。
描述
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 https://github.com/python/cpython/pull/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.
#endif
but 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.
- 主要语言
- Python
- 星标
- 13.9k
- 派生
- 2.6k
- 平均合并
- 1 天 7 小时
- 30 天内合并 PR
- 174
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-pillow/Pillow 的其他 Issue
-
TIFF without XResolution/YResolution reports dpi (1, 1)可能已有人在做 @brettdavies 于 2 天前认领。 未关闭🤖-assisted TIFF
难度 2/5 1-3 小时 新手友好度 75/100
python-pillow/Pillow#10332 · 2 条评论 ·
维护者通常 1 天内回复
-
Warn that pre-applying arabic_reshaper + python-bidi corrupts text on a Raqm build可能已有人在做 @Syamjith-NK 于 61 天前认领。 未关闭Documentation Font Rendering PNG Third Party Framework
难度 2/5 1-3 小时 新手友好度 78/100
python-pillow/Pillow#9907 · 2 条评论 ·
维护者通常 1 天内回复
-
Image.putpixel incorrectly labels supported arguments in type annotations可能已有人在做 @radarhere 于 189 天前认领。 未关闭PNG
难度 2/5 1-3 小时 新手友好度 70/100
python-pillow/Pillow#9584 · 1 条评论 ·
维护者通常 1 天内回复
-
JPEG saved with keep_rgb=True and dpi reopens with incorrect colors可能已有人在做 @Muguett-DBY 于 1 天前认领。 未关闭🤖-assisted JPEG
难度 4/5 1-2 天 新手友好度 25/100
python-pillow/Pillow#10344 ·
维护者通常 1 天内回复
-
JPEG dpi read from EXIF uses XResolution for both axes可能已有人在做 @unvisible789 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 20/100
python-pillow/Pillow#10331 · 1 条评论 ·
维护者通常 1 天内回复
查看 python-pillow/Pillow 的全部 Issue
相似的 Issue
-
app: scripts status: backlog type: documentation
难度 2/5 1-3 小时 新手友好度 86/100
netbox-community/netbox-scripts#68 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 91/100
marin-community/marin#10765 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
flathub/com.unity.UnityHub#230 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
namespace operations
难度 1/5 1 小时以内 新手友好度 63/100
EclipseFdn/open-vsx.org#14910 ·
维护者通常 1 天内回复