Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install: fails to build relstorage.cache.cache extension #499

Closed
larsks opened this issue Jul 16, 2023 · 6 comments
Closed

Unable to install: fails to build relstorage.cache.cache extension #499

larsks opened this issue Jul 16, 2023 · 6 comments

Comments

@larsks
Copy link

larsks commented Jul 16, 2023

I'm trying to install RelStorage on python 3.11, with gcc version 13.1.1. pip install RelStorage[sqlite3] fails with:

      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc/relstorage/cache -Isrc/relstorage -Iinclude -I/home/lars/tmp/python/.venv/include -I/usr/include/python3.11 -c src/relstorage/cache/c_cache.cpp -o build/temp.linux-x86_64-cpython-311/src/relstorage/cache/c_cache.o
      In file included from /usr/include/c++/13/ext/alloc_traits.h:34,
                       from /usr/include/c++/13/bits/stl_uninitialized.h:64,
                       from /usr/include/c++/13/memory:69,
                       from src/relstorage/cache/c_cache.cpp:15:
      /usr/include/c++/13/bits/alloc_traits.h: In instantiation of ‘struct std::__allocator_traits_base::__rebind<relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry>, relstorage::cache::ProposedCacheEntry, void>’:
      /usr/include/c++/13/bits/alloc_traits.h:94:11:   required by substitution of ‘template<class _Alloc, class _Up> using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry>; _Up = relstorage::cache::ProposedCacheEntry]’
      /usr/include/c++/13/bits/alloc_traits.h:228:8:   required by substitution of ‘template<class _Alloc> template<class _Tp> using std::allocator_traits< <template-parameter-1-1> >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = relstorage::cache::ProposedCacheEntry; _Alloc = relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry>]’
      /usr/include/c++/13/ext/alloc_traits.h:126:65:   required from ‘struct __gnu_cxx::__alloc_traits<relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry>, relstorage::cache::ProposedCacheEntry>::rebind<relstorage::cache::ProposedCacheEntry>’
      /usr/include/c++/13/bits/stl_vector.h:88:21:   required from ‘struct std::_Vector_base<relstorage::cache::ProposedCacheEntry, relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry> >’
      /usr/include/c++/13/bits/stl_vector.h:425:11:   required from ‘class std::vector<relstorage::cache::ProposedCacheEntry, relstorage::PythonAllocator<relstorage::cache::ProposedCacheEntry> >’
      src/relstorage/cache/c_cache.h:523:26:   required from here
      /usr/include/c++/13/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A
         70 |                         _Tp>::value,
            |                               ^~~~~
      /usr/include/c++/13/bits/alloc_traits.h:70:31: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
      error: command '/usr/bin/gcc' failed with exit code 1

I'm not intimately familiar with C++ so I'm not sure if this represents a real error, some sort of version skew in the compiler, or something else.

@margaridasp
Copy link

I have the same problem on Fedora 38, gcc version 13.2.1
I found a project where they seem to have had this issue and fixed it, apparently by specifying some "rebind" type: nlohmann/json#3895

@jamadden
Copy link
Member

Please try with Relstorage 4.

@margaridasp
Copy link

Please try with Relstorage 4.

Thank you @jamadden I was able to install it now, with version 4! :)

@MJuddBooth
Copy link

Unfortunately, @jamadden, I am still getting that same build error with the head of the master branch. python3.11.6, gcc 13.2.0 .

@MJuddBooth
Copy link

MJuddBooth commented Nov 3, 2023

And I have no idea whether this does the right thing but adding the following (as suggested by gcc 13 porting):
template <class U> struct rebind { using other = PythonAllocator<U>; };
to src/relstorage/_rs_types.h allows it to build.

@jamadden
Copy link
Member

I thought the necessary change had made it into the last pre-release version of RelStorage 4, but (obviously) it hadn't.

I've made and tested the necessary change, and officially released RelStorage 4. (Binary wheels are still building, trickling in as they finish.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants