Closed 8banzhuan closed 2 years ago
@adamnovak This looks like it's something going on with hashing your new path metadata fields. Maybe because you don't explicitly define a hash function in types.hpp
? I don't think any of us are testing with as old a version of g++
as this anymore, so maybe this behavior has changed.
I think that this is this compiler bug with the implementation of C++14 in gcc, which was fixed in GCC 6.1 and later.
I think the right way for the project to deal with this might be to bump our declared minimum GCC version on the vg README, and maybe in the build system for libhandlegraph, so we don't claim to be compatible back to GCC 4.9 anymore. We don't actually ever test on 4.9 anymore, which is why we've managed to break compatibility. We currently build CI on Ubuntu 20.04, which ships GCC 9.4.
The right way for @8banzhuan to deal with this is probably to upgrade GCC and/or Ubuntu. If you can't do that, a workaround would be to define an implementation for std::hash<handlegraph::PathSense>
, which would be pretty simple because it would just cast to an int and hash that.
We could add our own implementation, maybe behind a compiler version check, but it's likely that we'll use other C++14 features that aren't fully supported by compilers this old, or even start to bring in C++17 features, given that it's almost 2023, and those might not work back to GCC 5.4.
@8banzhuan How feasible is it for you to upgrade your compiler?
我认为这是在 gcc 中实现 C++14 的编译器错误,在 GCC 6.1 及更高版本中已修复。
我认为该项目处理此问题的正确方法可能是在 vg README 上以及可能在 libhandlegraph 的构建系统中增加我们声明的最低 GCC 版本,因此我们不再声称与 GCC 4.9 兼容。我们实际上不再在 4.9 上进行测试,这就是我们设法破坏兼容性的原因。我们目前在 Ubuntu 20.04 上构建 CI,它附带 GCC 9.4。
正确的方法@8banzhuan解决这个问题可能是升级 GCC 和/或 Ubuntu。如果你不能这样做,一种解决方法是为 定义一个实现
std::hash<handlegraph::PathSense>
,这将非常简单,因为它只会强制转换为 int 并对其进行哈希处理。我们可以添加我们自己的实现,也许在编译器版本检查之后,但我们很可能会使用其他 C++14 功能,这些功能不被这么旧的编译器完全支持,甚至开始引入 C++17 功能,考虑到它几乎是 2023 年,而_这些_可能无法回到 GCC 5.4。
@8banzhuan您升级编译器的可行性如何? Thank you very much for your suggestion. I upgraded the version of g++ yesterday, and now there is no problem. Thank you again for your prompt reply and suggestion. Good luck
Thank you for developing such a set of efficient tools, now I encountered some small troubles when making, the specific error information is as follows
root@ubuntu:/home/yaozhen/libhandlegraph/build# make [ 2%] Building CXX object CMakeFiles/handlegraph_objs.dir/src/path_metadata.cpp .o In file included from /usr/include/c++/5/bits/hashtable.h:35:0, from /usr/include/c++/5/unordered_set:47, from /home/yaozhen/libhandlegraph/src/include/handlegraph/path_ metadata.hpp:13, from /home/yaozhen/libhandlegraph/src/path_metadata.cpp:5: /usr/include/c++/5/bits/hashtable_policy.h: In instantiation of ‘struct std::__d etail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegraph::PathSen se> >’: /usr/include/c++/5/type_traits:137:12: required from ‘struct std::__and_<std:: __is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept _hash<handlegraph::PathSense, std::hash<handlegraph::PathSense> > >’ /usr/include/c++/5/type_traits:148:38: required from ‘struct std::__not_<std:: __and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::_ _is_noexcept_hash<handlegraph::PathSense, std::hash<handlegraph::PathSense> > > >’ /usr/include/c++/5/bits/unordered_set.h:95:63: required from ‘class std::unord ered_set<handlegraph::PathSense>’ /home/yaozhen/libhandlegraph/src/include/handlegraph/path_metadata.hpp:279:41: required from here /usr/include/c++/5/bits/hashtable_policy.h:85:34: error: no match for call to ‘( const std::hash<handlegraph::PathSense>) (const handlegraph::PathSense&)’ noexcept(declval<const _Hash&>()(declval<const _Key&>()))> ^ In file included from /usr/include/c++/5/bits/move.h:57:0, from /usr/include/c++/5/bits/stl_pair.h:59, from /usr/include/c++/5/utility:70, from /home/yaozhen/libhandlegraph/src/include/handlegraph/types .hpp:9, from /home/yaozhen/libhandlegraph/src/include/handlegraph/handl e_graph.hpp:8, from /home/yaozhen/libhandlegraph/src/include/handlegraph/path_ metadata.hpp:8, from /home/yaozhen/libhandlegraph/src/path_metadata.cpp:5: /usr/include/c++/5/type_traits: In instantiation of ‘struct std::__not_<std::__a nd_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is _noexcept_hash<handlegraph::PathSense, std::hash<handlegraph::PathSense> > > >’: /usr/include/c++/5/bits/unordered_set.h:95:63: required from ‘class std::unord ered_set<handlegraph::PathSense>’ /home/yaozhen/libhandlegraph/src/include/handlegraph/path_metadata.hpp:279:41: required from here /usr/include/c++/5/type_traits:148:38: error: ‘value’ is not a member of ‘std::_ _and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__ is_noexcept_hash<handlegraph::PathSense, std::hash<handlegraph::PathSense> > >’ : public integral_constant<bool, !_Pp::value> ^ In file included from /usr/include/c++/5/unordered_set:48:0, from /home/yaozhen/libhandlegraph/src/include/handlegraph/path_ metadata.hpp:13, from /home/yaozhen/libhandlegraph/src/path_metadata.cpp:5: /usr/include/c++/5/bits/unordered_set.h: In instantiation of ‘class std::unorder ed_set<handlegraph::PathSense>’: /home/yaozhen/libhandlegraph/src/include/handlegraph/path_metadata.hpp:279:41: required from here /usr/include/c++/5/bits/unordered_set.h:95:63: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; ^ /usr/include/c++/5/bits/unordered_set.h:102:45: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::key_type key_type; ^ /usr/include/c++/5/bits/unordered_set.h:103:47: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::value_type value_type; ^ /usr/include/c++/5/bits/unordered_set.h:104:43: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::hasher hasher; ^ /usr/include/c++/5/bits/unordered_set.h:105:46: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::key_equal key_equal; ^ /usr/include/c++/5/bits/unordered_set.h:106:51: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::allocator_type allocator_type; ^ /usr/include/c++/5/bits/unordered_set.h:111:45: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::pointer pointer; ^ /usr/include/c++/5/bits/unordered_set.h:112:50: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::const_pointer const_pointer; ^ /usr/include/c++/5/bits/unordered_set.h:113:47: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::reference reference; ^ /usr/include/c++/5/bits/unordered_set.h:114:52: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::const_reference const_reference; ^ /usr/include/c++/5/bits/unordered_set.h:115:46: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::iterator iterator; ^ /usr/include/c++/5/bits/unordered_set.h:116:51: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::const_iterator const_iterator; ^ /usr/include/c++/5/bits/unordered_set.h:117:51: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::local_iterator local_iterator; ^ /usr/include/c++/5/bits/unordered_set.h:118:57: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::const_local_iterator const_local_iterator; ^ /usr/include/c++/5/bits/unordered_set.h:119:47: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::size_type size_type; ^ /usr/include/c++/5/bits/unordered_set.h:120:52: error: ‘value’ is not a member o f ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegr aph::PathSense> > > >’ typedef typename _Hashtable::difference_type difference_type; ^ /usr/include/c++/5/bits/unordered_set.h:274:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ operator=(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_set.h:368:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ emplace(_Args&&... __args) ^ /usr/include/c++/5/bits/unordered_set.h:412:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ insert(const value_type& __x) ^ /usr/include/c++/5/bits/unordered_set.h:416:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ insert(value_type&& __x) ^ /usr/include/c++/5/bits/unordered_set.h:471:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ insert(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_set.h:616:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ equal_range(const key_type& __x) ^ /usr/include/c++/5/bits/unordered_set.h:620:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<handlegraph::PathSense> >, std::__detail::__is_noexcept_hash<handlegraph::PathSense, std::hash<handlegra ph::PathSense> > > >’ equal_range(const key_type& __x) const ^ /home/yaozhen/libhandlegraph/src/path_metadata.cpp: In lambda function: /home/yaozhen/libhandlegraph/src/path_metadata.cpp:338:32: error: ‘const class s td::unordered_set<handlegraph::PathSense>’ has no member named ‘count’ if (senses && !senses->count(get_sense(handle))) { ^ CMakeFiles/handlegraph_objs.dir/build.make:134: recipe for target 'CMakeFiles/ha ndlegraph_objs.dir/src/path_metadata.cpp.o' failed make[2]: *** [CMakeFiles/handlegraph_objs.dir/src/path_metadata.cpp.o] Error 1 CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/handlegraph_objs.dir/all ' failed make[1]: *** [CMakeFiles/handlegraph_objs.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2
My system is Ubuntu 16.04 g++ and gcc version is 5.4.0