Closed chxmberland closed 1 month ago
I made some progress here, when I run export SETUPTOOLS_USE_DISTUTILS=stdlib
and then python3 -m pip install cffi
, I get the following outputs.
<string>:69: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
_configtest.c:2:2: error: #error "not MSVC"
2 | #error "not MSVC"
| ^~~~~
Note: will not use '__thread' in the C code
***** The above error message can be safely ignored.
I believe that this error is ignored thanks to the export SETUPTOOLS_USE_DISTUTILS=stdlib
. However, this is followed by...
building '_cffi_backend' extension
creating build/temp.mingw_x86_64-3.11
creating build/temp.mingw_x86_64-3.11/src
creating build/temp.mingw_x86_64-3.11/src/c
gcc -DNDEBUG -g -fwrapv -O3 -Wall -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -O3 -DFFI_BUILDING=1 -IC:/msys64/mingw64/include/python3.11 -c src/c/_cffi_backend.c -o build/temp.mingw_x86_64-3.11/src/c/_cffi_backend.o
src/c/_cffi_backend.c: In function 'b_do_dlopen':
src/c/_cffi_backend.c:4521:40: error: passing argument 1 of 'PyUnicode_AsWideChar' from incompatible pointer type [-Wincompatible-pointer-types]
4521 | sz1 = PyUnicode_AsWideChar((PyUnicodeObject *)filename_unicode,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| PyUnicodeObject *
In file included from C:/msys64/mingw64/include/python3.11/Python.h:51,
from src/c/_cffi_backend.c:2:
C:/msys64/mingw64/include/python3.11/unicodeobject.h:299:15: note: expected 'PyObject *' {aka 'struct _object *'} but argument is of type 'PyUnicodeObject *'
299 | PyObject *unicode, /* Unicode object */
| ~~~~~~~~~~^~~~~~~
error: command 'C:\\msys64\\mingw64\\bin/gcc.exe' failed with exit code 1
A colleague helped me to solve the issue. Initially, this issue was a result of trying to install the cryptography
library. Since cffi
is a dependency, its subsequent installation was failing.
It looks like MSYS2 has a specific Python cryptography package that can be installed for this situation as pacman -Sy --needed mingw-w64-x86_64-python3-cryptography
.
After I installed this package, the cryptography
package worked fine. However, I'll leave this issue open for now as I don't think the issue wasn't directly resolved with cffi
. I
Thanks for the report, this looks like a superficial error easily fixed (see PR #91).
Can this issue be closed or is there a remaining TODO?
Yep, closing as completed since it's merged- the change will likely be included in 1.17.1
Description
I am currently attempting to install CFFI on my Windows machine running MSYS2 MINGW64 using the terminal command
pip install cffi
.System and Versions
OS: Windows 11, MSYS2 MINGW64 Python: 3.11.9 Pip: 24.1 CFFI: 1.16, 1.15.1, 1.15 (versions with which I could reproduce this error)
However, I get the following error:
Discussion from #21 did not seem to yield similar results to those in that thread. For example, running
pip install --no-build-isolation cffi
does not make any difference. Additionally, I get the same error running bothpip install cffi==1.15.1
andpip install cffi==1.15
.Furthermore, solutions to similar issues in this Stack Overflow thread did not seem to work either. Specifically, using
SETUPTOOLS_USE_DISTUTILS=stdlib
.Any help or insights would be greatly appreciated!