Error when using libraries argument with Python setuptools
Description / Steps to reproduce the issue
installing gcc and python-pip, I created the following Python script, along with an empty file called demo.c in the current directory
from setuptools import setup
setup(
name='msys2demo',
libraries=[
("example", {"sources": ["demo.c"]}),
],
version='0.0.1'
)% [
I then ran python3 -m pip install .
For an exact replica, I've created https://github.com/radarhere/msys2 where you can see the output in GitHub Actions.
Expected behavior A successful installation of my custom Python module. You can see the expected success if I change the situation in the following ways
- If I don't use the
librariesargument in the Python script, it works. - If I run the same Python script in Ubuntu, it works.
- If I run
AR="ar" python3 -m pip install ., it works. This was suggested over at python-pillow, as an alternative to the default use of/clang64/bin/llvm-ar
Actual behavior An error - https://github.com/radarhere/msys2/actions/runs/18629427989/job/53112005909#step:5:38
Building wheel for msys2demo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
Building wheel for msys2demo (pyproject.toml) did not run successfully.
exit code: 1
[8 lines of output]
running bdist_wheel
running build
running build_clib
building 'example' library
creating build/temp.mingw_x86_64_ucrt_llvm-cpython-312
clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -c demo.c -o build/temp.mingw_x86_64_ucrt_llvm-cpython-312/demo.o
/clang64/bin/llvm-ar rcs build/temp.mingw_x86_64_ucrt_llvm-cpython-312/libexample.a build/temp.mingw_x86_64_ucrt_llvm-cpython-312/demo.o
error: command '/clang64/bin/llvm-ar' failed: None
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for msys2demo
uname: MINGW64_NT-10.0-26100 Environment tested: CLANG64
Thanks. If you think this should be reported elsewhere, please let me know.
x-ref https://github.com/msys2/MINGW-packages/pull/25966#issuecomment-3410866225
It's a bug in our Python build: https://github.com/msys2-contrib/cpython-mingw/issues/200