compile error with _PyFloat_Pack2 with 3.11
arunpersaud opened this issue · 4 comments
arunpersaud commented
It seems as if these functions are now private (see python/cpython#91062)
For bitstruct there is eerimoq/bitstruct#26, is something similar needed for cbistruct? If so, I'm happy to supply a PR, but I'm otherwise not that familiar with the C-API.
Without this, I get the following error (on an M1 mac using python 3.11):
Obtaining file:///Users/arun/roots/cbitstruct
Preparing metadata (setup.py) ... done
Installing collected packages: cbitstruct
Attempting uninstall: cbitstruct
Found existing installation: cbitstruct 1.0.7
Can't uninstall 'cbitstruct'. No files were found to uninstall.
Running setup.py develop for cbitstruct
error: subprocess-exited-with-error
× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
running develop
/opt/homebrew/lib/python3.11/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/opt/homebrew/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running egg_info
writing cbitstruct.egg-info/PKG-INFO
writing dependency_links to cbitstruct.egg-info/dependency_links.txt
writing top-level names to cbitstruct.egg-info/top_level.txt
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.md'
writing manifest file 'cbitstruct.egg-info/SOURCES.txt'
running build_ext
building 'cbitstruct._cbitstruct' extension
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -Icbitstruct/ -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c cbitstruct/_cbitstruct.c -o build/temp.macosx-13-arm64-cpython-311/cbitstruct/_cbitstruct.o -std=c11 -Wall -Werror -O3
cbitstruct/_cbitstruct.c:502:17: error: implicit declaration of function '_PyFloat_Pack2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
_PyFloat_Pack2(cv, el->raw, PY_LITTLE_ENDIAN);
^
cbitstruct/_cbitstruct.c:502:17: note: did you mean 'PyFloat_Pack2'?
/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/cpython/floatobject.h:15:17: note: 'PyFloat_Pack2' declared here
PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le);
^
cbitstruct/_cbitstruct.c:578:29: error: implicit declaration of function '_PyFloat_Unpack2' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
double cv = _PyFloat_Unpack2(el->raw, PY_LITTLE_ENDIAN);
^
cbitstruct/_cbitstruct.c:578:29: note: did you mean 'PyFloat_Unpack2'?
/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11/cpython/floatobject.h:19:20: note: 'PyFloat_Unpack2' declared here
PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le);
^
2 errors generated.
error: command '/opt/homebrew/opt/llvm@11/bin/clang' failed with exit code 1
[end of output]
qchateau commented
Thank you for reporting this, I'll try to have a look over the next couple of days
qchateau commented
1.0.8 should work with python 3.11
Let me know if you still face problems
arunpersaud commented
yes, that worked. Thanks for the quick fix!
I had to install from github though, since pypi didn't have any source distribution, so pip install cbitstruct
didn't work.
qchateau commented
Good catch, 1.0.9 should have the sources