FTBFS in MSYS2 LLVM based environments
It seems the new common Mode.c library in Pillow 12.0.0 fails to build OOTB in MSYS2 LLVM based environments like CLANG64/CLANGARM64:
https://github.com/msys2/MINGW-packages/actions/runs/18555260796/job/52891070931?pr=25966#step:10:466
It does build in MSYS2 GCC based environments like UCRT64/MINGW64:
https://github.com/msys2/MINGW-packages/actions/runs/18555260796/job/52891070947?pr=25966#step:10:464
The Pillow CI covers MINGW64 only.
Originally posted by @kmilos in https://github.com/python-pillow/Pillow/issues/9256#issuecomment-3410010070
All I'm seeing in the logs is error: command '/clangarm64/bin/llvm-ar' failed: None, which isn't terribly informative. Can you see anything else that's more helpful?
Unfortunatly not. /clangarm64/bin/llvm-ar.exe (and its alias /clangarm64/bin/ar.exe) do exist and are installed by the llvm-tools sub-package as part of the toolchain (confirmed present in the log).
It looks like it doesn't like the incomplete /clangarm64/bin/llvm-ar without the .exe extension? No idea where setuptools is getting it from...
The workaround is to set AR="ar" so it ends up with an unqualified command like in the GCC case. (As mentioned, /clangarm64/bin/ar.exe is a copy of /clangarm64/bin/llvm-ar.exe.)
Mode.c was added in #9256, and testing, I indeed find this would have passed just before that PR.
I've put together a minimal reproduction showing that the same error results just from
from setuptools import setup
setup(
name='msys2demo',
libraries=[
("example", {"sources": ["demo.c"]}),
],
version='0.0.1'
)
and an empty demo.c. Without libraries, the error doesn't occur.
Would you suggest this be reported to https://github.com/pypa/setuptools, https://github.com/msys2/MINGW-packages, or somewhere else?
Not sure. Someone familiar w/ setuptools would have to first figure out how /clang64/bin/llvm-ar gets expanded instead of ar in the other environment.
I've created https://github.com/msys2/MINGW-packages/issues/26006
Mode.c was added
Hm, I'm finding comments that build_clib is obsolete?
https://github.com/pypa/setuptools/blob/a49f6b927d83b97630b4fb030de8035ed32436fd/docs/userguide/ext_modules.rst?plain=1#L104
https://github.com/msys2/MINGW-packages/issues/26006#issuecomment-3463627691
It's a bug in our Python build: msys2-contrib/cpython-mingw#200