pavel-odintsov / fastnetmon

FastNetMon - very fast DDoS sensor with sFlow/Netflow/IPFIX/SPAN support
https://fastnetmon.com
GNU General Public License v2.0
3.42k stars 567 forks source link

capnp fails to compile on Fedora 38 #965

Closed pavel-odintsov closed 1 year ago

pavel-odintsov commented 1 year ago

Error:

/usr/bin/g++ -DENABLE_CAPNP -DENABLE_GOBGP -DFASTNETMON_API -DFASTNETMON_ENABLE_AFPACKET -DFASTNETMON_ENABLE_AF_XDP -DMONGO -I/opt/fastnetmon-community/libraries/abseil_2022_06_23/include -I/opt/fastnetmon-community/libraries/bpf_1_0_1/include -I/opt/fastnetmon-community/libraries/capnproto_0_8_0/include -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -DNDEBUG --std=c++2a -MD -MT CMakeFiles/simple_packet_capnp.dir/simple_packet_capnp/simple_packet.capnp.c++.o -MF CMakeFiles/simple_packet_capnp.dir/simple_packet_capnp/simple_packet.capnp.c++.o.d -o CMakeFiles/simple_packet_capnp.dir/simple_packet_capnp/simple_packet.capnp.c++.o -c /root/rpmbuild/BUILD/fastnetmon-master/src/simple_packet_capnp/simple_packet.capnp.c++
In file included from /usr/include/capnp/layout.h:34,
                 from /usr/include/capnp/generated-header-support.h:27,
                 from /root/rpmbuild/BUILD/fastnetmon-master/src/simple_packet_capnp/simple_packet.capnp.h:6,
                 from /root/rpmbuild/BUILD/fastnetmon-master/src/simple_packet_capnp/simple_packet.capnp.c++:4:
/usr/include/capnp/blob.h: In function 'bool capnp::operator==(const char*, const Text::Builder&)':
/usr/include/capnp/blob.h:176:74: error: no match for 'operator==' (operand types are 'const char*' and 'kj::StringPtr')
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |                                                                        ~ ^~ ~~~~~~~~~~~~
      |                                                                        |              |
      |                                                                        const char*    kj::StringPtr
In file included from /usr/include/kj/memory.h:24,
                 from /usr/include/kj/array.h:24,
                 from /usr/include/kj/string.h:25,
                 from /usr/include/capnp/common.h:29,
                 from /usr/include/capnp/raw-schema.h:24,
                 from /usr/include/capnp/generated-header-support.h:26:
/usr/include/kj/common.h:756:13: note: candidate: 'template<class T> bool kj::operator==(T, MaxValue_)' (reversed)
  756 | inline bool operator==(T t, MaxValue_) { return t == Decay<T>(maxValue); }
      |             ^~~~~~~~
/usr/include/kj/common.h:756:13: note:   template argument deduction/substitution failed:
/usr/include/capnp/blob.h:176:72: note:   cannot convert 'a' (type 'const char*') to type 'kj::MaxValue_'
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |                                                                        ^
/usr/include/kj/common.h:758:13: note: candidate: 'template<class T> bool kj::operator==(T, MinValue_)' (reversed)
  758 | inline bool operator==(T t, MinValue_) { return t == Decay<T>(minValue); }
      |             ^~~~~~~~
/usr/include/kj/common.h:758:13: note:   template argument deduction/substitution failed:
/usr/include/capnp/blob.h:176:72: note:   cannot convert 'a' (type 'const char*') to type 'kj::MinValue_'
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |                                                                        ^
/usr/include/capnp/blob.h:176:13: note: candidate: 'bool capnp::operator==(const char*, const Text::Builder&)' (reversed)
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |             ^~~~~~~~
/usr/include/capnp/blob.h:176:36: note:   no known conversion for argument 1 from 'kj::StringPtr' to 'const char*'
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |                        ~~~~~~~~~~~~^
/usr/include/capnp/blob.h: In function 'bool capnp::operator!=(const char*, const Text::Builder&)':
/usr/include/capnp/blob.h:177:74: error: no match for 'operator!=' (operand types are 'const char*' and 'kj::StringPtr')
  177 | inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); }
      |                                                                        ~ ^~ ~~~~~~~~~~~~
      |                                                                        |              |
      |                                                                        const char*    kj::StringPtr
/usr/include/kj/common.h:756:13: note: candidate: 'template<class T> bool kj::operator==(T, MaxValue_)' (reversed)
  756 | inline bool operator==(T t, MaxValue_) { return t == Decay<T>(maxValue); }
      |             ^~~~~~~~
/usr/include/kj/common.h:756:13: note:   template argument deduction/substitution failed:
/usr/include/capnp/blob.h:177:72: note:   cannot convert 'a' (type 'const char*') to type 'kj::MaxValue_'
  177 | inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); }
      |                                                                        ^
/usr/include/kj/common.h:758:13: note: candidate: 'template<class T> bool kj::operator==(T, MinValue_)' (reversed)
  758 | inline bool operator==(T t, MinValue_) { return t == Decay<T>(minValue); }
      |             ^~~~~~~~
/usr/include/kj/common.h:758:13: note:   template argument deduction/substitution failed:
/usr/include/capnp/blob.h:177:72: note:   cannot convert 'a' (type 'const char*') to type 'kj::MinValue_'
  177 | inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); }
      |                                                                        ^
/usr/include/capnp/blob.h:176:13: note: candidate: 'bool capnp::operator==(const char*, const Text::Builder&)' (reversed)
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |             ^~~~~~~~
/usr/include/capnp/blob.h:176:36: note:   no known conversion for argument 1 from 'kj::StringPtr' to 'const char*'
  176 | inline bool operator==(const char* a, const Text::Builder& b) { return a == b.asString(); }
      |                        ~~~~~~~~~~~~^
/usr/include/capnp/blob.h:177:13: note: candidate: 'bool capnp::operator!=(const char*, const Text::Builder&)'
  177 | inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); }
      |             ^~~~~~~~
/usr/include/capnp/blob.h:177:60: note:   no known conversion for argument 2 from 'kj::StringPtr' to 'const capnp::Text::Builder&'
  177 | inline bool operator!=(const char* a, const Text::Builder& b) { return a != b.asString(); }
      |                                       ~~~~~~~~~~~~~~~~~~~~~^
[ 38%] Linking CXX static library libfastnetmon_pcap_format.a
pavel-odintsov commented 1 year ago

The very luckily cause it upstream issue in capnp: https://github.com/capnproto/capnproto/issues/1622

pavel-odintsov commented 1 year ago

It's clearly upstream issue: https://github.com/capnproto/capnproto/issues/1622

I've attached original and patches version of string.h which addresses this issue.

string.zip

pavel-odintsov commented 1 year ago

Yay, fixed in upstream.