Closed mxilinas closed 5 months ago
👍
thank you for sharing! Let's add
Same issue for me. I added #include <new>
to the beginning of faster-fifo.cpp and tried to build. But it shows the same error.
Python version: 3.9.19 OS: Fedora 40
$python setup.py build_ext --inplace
Compiling faster_fifo.pyx because it depends on /home/jawad/anaconda3/envs/llarp-2/lib/python3.12/site-packages/Cython/Includes/libcpp/__init__.pxd.
[1/1] Cythonizing faster_fifo.pyx
running build_ext
building 'faster_fifo' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/cpp_faster_fifo
creating build/temp.linux-x86_64-cpython-312/cpp_faster_fifo/cpp_lib
gcc -pthread -B /home/jawad/anaconda3/envs/llarp-2/compiler_compat -fno-strict-overflow -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/jawad/anaconda3/envs/llarp-2/include -fPIC -O2 -isystem /home/jawad/anaconda3/envs/llarp-2/include -fPIC -Icpp_faster_fifo/cpp_lib -I/home/jawad/anaconda3/envs/llarp-2/include/python3.12 -c cpp_faster_fifo/cpp_lib/faster_fifo.cpp -o build/temp.linux-x86_64-cpython-312/cpp_faster_fifo/cpp_lib/faster_fifo.o -std=c++11
cpp_faster_fifo/cpp_lib/faster_fifo.cpp: In function ‘void create_queue(void*, size_t, size_t)’:
cpp_faster_fifo/cpp_lib/faster_fifo.cpp:133:56: error: no matching function for call to ‘operator new(sizetype, void*&)’
133 | new(queue_obj_memory) Queue(max_size_bytes, maxsize);
| ^
<built-in>: note: candidate: ‘void* operator new(long unsigned int)’
<built-in>: note: candidate expects 1 argument, 2 provided
error: command '/usr/bin/gcc' failed with exit code 1
I added the include here.
END: Cython Metadata */
#include <new>
#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
#if defined(CYTHON_LIMITED_API) && 0
#ifndef Py_LIMITED_API
#if CYTHON_LIMITED_API+0 > 0x03030000
#define Py_LIMITED_API CYTHON_LIMITED_API
#else
#define Py_LIMITED_API 0x03030000
#endif
#endif
#endif
Not sure why it would give the same error after including. Interestingly, after executing the python setup.py command a couple of times, the edited faster-fifo.cpp file reverts to original. Will greatly appreciate any help.
@mxilinas @enchanted-crow released the new version, should have the missing header https://pypi.org/project/faster-fifo/1.4.7/ Thank you for finding this!
Hello, I encountered the following issue while installing with pip. python version: 3.12.3 OS: ArchLinux
I was able to fix it by including \ in faster_fifo.cpp and compiling/installing the package from the tarball.