Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

FTBFS in MSYS2 LLVM based environments

Open kmilos opened this issue 2 months ago • 7 comments

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

kmilos avatar Oct 16 '25 09:10 kmilos

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).

kmilos avatar Oct 16 '25 09:10 kmilos

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.)

kmilos avatar Oct 16 '25 13:10 kmilos

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?

radarhere avatar Oct 18 '25 12:10 radarhere

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.

kmilos avatar Oct 19 '25 06:10 kmilos

I've created https://github.com/msys2/MINGW-packages/issues/26006

radarhere avatar Oct 19 '25 11:10 radarhere

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

kmilos avatar Oct 21 '25 15:10 kmilos

https://github.com/msys2/MINGW-packages/issues/26006#issuecomment-3463627691

It's a bug in our Python build: msys2-contrib/cpython-mingw#200

radarhere avatar Oct 29 '25 20:10 radarhere