martinus / unordered_dense

A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion
MIT License
898 stars 72 forks source link

Does not compile on gcc 8.3 with no-rtti (pmr) #109

Open greenrobot opened 8 months ago

greenrobot commented 8 months ago

For crosscompiling, we rely on older compiler versions.

Because of pmr (we do not do anything with pmr), compilation fails.

Does it require pmr internally, or only if the user uses it? Maybe it could "just" be disabled completely? I think pmr is not a great dependency to have: while compilers support C++17 for a long time, pmr only came with gcc 9. And relying on "experimental" API (pre gcc 9) does not make one very comfortable, either.

In file included from ../../../../../../../objectbox/src/main/cpp/external/unordered-dense/unordered_dense.h:107,
                 from ...
/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource: In instantiation of 'bool std::experimental::fundamentals_v2::pmr::__resource_adaptor_imp<_Alloc>::do_is_equal(const std::experimental::fundamentals_v2::pmr::memory_resource&) const [with _Alloc = std::allocator<char>]':
/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource:320:7:   required from here
/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource:322:13: error: 'dynamic_cast' not permitted with -fno-rtti
  auto __p = dynamic_cast<const __resource_adaptor_imp*>(&__other);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[3]: *** [src/CMakeFiles/something.dir/hnsw/HnswTypes.cpp.o] Error 1
gmake[3]: *** Waiting for unfinisgmake[3]: *** [src/CMakeFiles/something.dir/hnsw/HnswTypes.cpp.o] Error 1
hed jobs....
In file included from ../../../../../../../external/unordered-dense/unordered_dense.h:107,
                 from ...

/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource: In instantiation of 'bool std::experimental::fundamentals_v2::pmr::__resource_adaptor_imp<_Alloc>::do_is_equal(const std::experimental::fundamentals_v2::pmr::memory_resource&) const [with _Alloc = std::allocator<char>]':
/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource:320:7:   required from here
/opt/aarch64-linux-gnu/aarch64-linux-gnu/include/c++/8.3.0/experimental/memory_resource:322:13: error: 'dynamic_cast' not permitted with -fno-rtti
  auto __p = dynamic_cast<const __resource_adaptor_imp*>(&__other);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
martinus commented 3 days ago

Can't reproduce, I can successfully compile with gcc 8.4. Does that work for you?

greenrobot commented 3 days ago

Can't reproduce, I can successfully compile with gcc 8.4. Does that work for you?

Well, it does not work with 8.3 as noted in the issue.

For crosscompiling, we rely on older compiler versions.

Our workaround is to use using typdefs and not use unordered_dense at all for gcc8.3 targets.

As you already closed this issue, I'll assume that do not have plans to support anything newer than 8.4. Would you consider a compiler check or noting this in the documentation?

martinus commented 2 days ago

I can add a macro to disable inclusion of PMR stuff if that's enough? Then you'll need to define that before including unordered_dense.h. I'm just wondering why you can't upgrade to at least 8.4, as it seems to work there.

greenrobot commented 2 days ago

I can add a macro to disable inclusion of PMR stuff if that's enough?

Sounds good.

I'm just wondering why you can't upgrade to at least 8.4

It's not in our hands. Sometimes there are corporate policies and eternal processes that dictate what to use... :shrug: