nebula c++20适配

需求:实现了一个图计算的任务,使用了c++20协程等feature,想从nebula storage直接读数据出来,但不想走storage client的rpc,计算任务想直接调用storage的processor来读数据,需要将计算任务和nebula storage编译到同一个进程中。

目前的做法:打算将图计算任务的代码放在nebula代码仓库中一起编译,将nebula的编译选项改为c++20并打开协程。目前只先将nebula改成用c++20编译(还未合入我自己的代码),编译时出现了许多语法不兼容错误(这个好改),以及一些第三方库的错误(比如s2geometry)

In file included from /raid/msn/nebula/nebula/build/third-party/install/include/s2/s2shape_index.h:44,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/mutable_s2shape_index.h:37,
                 from /raid/msn/nebula/nebula/src/common/geo/GeoIndex.cpp:13:
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/compact_array.h: In instantiation of ‘class gtl::compact_array_base<S2ClippedShape, std::allocator<S2ClippedShape> >’:
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/compact_array.h:520:7:   required from ‘class gtl::compact_array<S2ClippedShape>’
/raid/msn/nebula/nebula/build/third-party/install/include/s2/s2shape_index.h:157:21:   required from here
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/compact_array.h:148:49: error: no class template named ‘rebind’ in ‘class std::allocator<S2ClippedShape>’
  148 |   typedef typename A::template rebind<T>::other value_allocator_type;
      |                                                 ^~~~~~~~~~~~~~~~~~~~
In file included from /raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/dense_hash_set.h:128,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/sequence_lexicon.h:26,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/id_set_lexicon.h:26,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/s2builder.h:30,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/s2boolean_operation.h:24,
                 from /raid/msn/nebula/nebula/build/third-party/install/include/s2/s2polygon.h:31,
                 from /raid/msn/nebula/nebula/src/common/geo/GeoIndex.cpp:19:
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h: In instantiation of ‘class gtl::dense_hashtable<unsigned int, unsigned int, SequenceLexicon<int>::IdHasher, gtl::dense_hash_set<unsigned int, SequenceLexicon<int>::IdHasher, SequenceLexicon<int>::IdKeyEqual, std::allocator<unsigned int> >::Identity, gtl::dense_hash_set<unsigned int, SequenceLexicon<int>::IdHasher, SequenceLexicon<int>::IdKeyEqual, std::allocator<unsigned int> >::SetKey, SequenceLexicon<int>::IdKeyEqual, std::allocator<unsigned int> >’:
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/dense_hash_set.h:156:6:   required from ‘class gtl::dense_hash_set<unsigned int, SequenceLexicon<int>::IdHasher, SequenceLexicon<int>::IdKeyEqual, std::allocator<unsigned int> >’
/raid/msn/nebula/nebula/build/third-party/install/include/s2/sequence_lexicon.h:138:9:   required from ‘class SequenceLexicon<int>’
/raid/msn/nebula/nebula/build/third-party/install/include/s2/id_set_lexicon.h:138:26:   required from here
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h:314:57: error: no class template named ‘rebind’ in ‘class std::allocator<unsigned int>’
  314 |   typedef typename Alloc::template rebind<Value>::other value_alloc_type;
      |                                                         ^~~~~~~~~~~~~~~~
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h:1020:35: error: no class template named ‘rebind’ in ‘class std::allocator<unsigned int>’
 1020 |   std::pair<size_type, size_type> find_position(const K& key) const {
      |                                   ^~~~~~~~~~~~~
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h:1030:35: error: no class template named ‘rebind’ in ‘class std::allocator<unsigned int>’
 1030 |   std::pair<size_type, size_type> find_position_using_hash(
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h:1060:30: error: no class template named ‘rebind’ in ‘class std::allocator<unsigned int>’
 1060 |   std::pair<size_type, bool> find_if_present(const K& key) const {
      |                              ^~~~~~~~~~~~~~~
/raid/msn/nebula/nebula/build/third-party/install/include/s2/util/gtl/densehashtable.h:1069:30: error: no class template named ‘rebind’ in ‘class std::allocator<unsigned int>’
 1069 |   std::pair<size_type, bool> find_if_present_using_hash(

尝试过将s2geometry库重新用c++20编译,然后手动放到third-party目录下,但仍然出现了这个库的报错。
目前咨询是否有大佬做过c++20的适配,如何解决第三方库编译的问题。或者是否能够将nebula编译成一个库,链接到我自己的代码中。(万分感谢

1 个赞

可以在third party项目里指定c++ 20试试,不过目前没做过相关适配

third-party那个项目是选master分支吗?我试过编译这个项目,没指定20我都编不过。那我再试试QAQ

图库版本3.3对应第三方库的哪个分支啊,我每个分支的代码都编不了,不用c++20都不行

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。