google / quiche

BSD 3-Clause "New" or "Revised" License
660 stars 132 forks source link

Compilation issue #72

Closed martenrichter closed 6 months ago

martenrichter commented 6 months ago

I run a weekly update on my plugin regarding libquiche. This week, it fails (only for Linux, not for Windows or Mac) with the following message:

FAILED: CMakeFiles/gquiche.dir/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc.o 
/usr/bin/c++ -DNAPI_VERSION=6 -D_ITERATOR_DEBUG_LEVEL=0 -I/workspaces/webtransport/transports/http3-quiche/platform -I/workspaces/webtransport/transports/http3-quiche/third_party/quiche -I/workspaces/webtransport/transports/http3-quiche/third_party/boringssl/src/include -I/workspaces/webtransport/transports/http3-quiche/third_party/abseil-cpp -I/workspaces/webtransport/transports/http3-quiche/third_party/googleurl -I/workspaces/webtransport/transports/http3-quiche/third_party/zlib -I/workspaces/webtransport/transports/http3-quiche/build_linux_x64/third_party/zlib -I/workspaces/webtransport/transports/http3-quiche/. -I/workspaces/webtransport/transports/http3-quiche/build_linux_x64 -I/workspaces/webtransport/node_modules/node-api-headers/include -I/workspaces/webtransport/node_modules/node-addon-api -I/workspaces/webtransport/transports/http3-quiche/third_party/protobuf/src -DBUILDING_NODE_EXTENSION -g -fPIC -std=gnu++20 -MD -MT CMakeFiles/gquiche.dir/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc.o -MF CMakeFiles/gquiche.dir/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc.o.d -o CMakeFiles/gquiche.dir/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc.o -c /workspaces/webtransport/transports/http3-quiche/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc
In file included from /usr/include/c++/12/bits/stl_algobase.h:66,
                 from /usr/include/c++/12/algorithm:60,
                 from /workspaces/webtransport/transports/http3-quiche/third_party/abseil-cpp/absl/types/span.h:55,
                 from /workspaces/webtransport/transports/http3-quiche/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.h:8,
                 from /workspaces/webtransport/transports/http3-quiche/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc:5:
/usr/include/c++/12/bits/stl_iterator_base_funcs.h: In instantiation of 'constexpr void std::__advance(_RandomAccessIterator&, _Distance, random_access_iterator_tag) [with _RandomAccessIterator = quic::QuicIntervalDeque<quic::BufferedSlice>::Iterator; _Distance = long int]':
/usr/include/c++/12/bits/stl_iterator_base_funcs.h:222:21:   required from 'constexpr void std::advance(_InputIterator&, _Distance) [with _InputIterator = quic::QuicIntervalDeque<quic::BufferedSlice>::Iterator; _Distance = long int]'
/usr/include/c++/12/bits/stl_algobase.h:1462:16:   required from 'constexpr _ForwardIterator std::__lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&, _Compare) [with _ForwardIterator = quic::QuicIntervalDeque<quic::BufferedSlice>::Iterator; _Tp = long unsigned int; _Compare = __gnu_cxx::__ops::_Iter_comp_val<quic::{anonymous}::CompareOffset>]'
/usr/include/c++/12/bits/stl_algo.h:2004:32:   required from 'constexpr _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare) [with _FIter = quic::QuicIntervalDeque<quic::BufferedSlice>::Iterator; _Tp = long unsigned int; _Compare = quic::{anonymous}::CompareOffset]'
/workspaces/webtransport/transports/http3-quiche/third_party/quiche/quiche/quic/core/quic_stream_send_buffer.cc:250:26:   required from here
/usr/include/c++/12/bits/stl_iterator_base_funcs.h:192:9: error: no match for 'operator--' (operand type is 'quic::QuicIntervalDeque<quic::BufferedSlice>::Iterator')
  192 |         --__i;
      |         ^~~~~
[186/210] Building CXX object CMakeFiles/gquiche.dir/third_party/quiche/quiche/quic/core/tls_server_handshaker.cc.o
ninja: build stopped: subcommand failed.

I can not make sense of the message. It is caused by the following commit: https://github.com/google/quiche/commit/f0aac12c3d3b0b6b965cca434666e911bc888550 it worked with 85ccecd18c57a81b22b8bc38bbe1455ad83c7229 . Given the content of the commit, I can not understand why the problem occurs. It may be that the headers' order was changed.

Compiler should be

Debian clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
DavidSchinazi commented 6 months ago

Thanks for reporting this, Marten! We just noticed the issue internally as well. We're working on a fix, we should have that landed later this week.

DavidSchinazi commented 6 months ago

For what it's worth, our current theory is that this was caused by e521a00feb2fbad4d81662b44fd8f6642013709c, not https://github.com/google/quiche/commit/f0aac12c3d3b0b6b965cca434666e911bc888550.

bencebeky commented 6 months ago

e521a00feb2fbad4d81662b44fd8f6642013709c changed Iterator::iterator_category to mark the iterator as random access. This means lookups are O(1), not O(n). std::lower_bound() would benefit from it. However, std::lower_bound() uses std::advance(), which requires a different set of methods to be implemented on the iterator on different platforms. Envoy builds with gcc also failed. d3bc5ffc929b0895ae9e16774069a04ae6fe3c58 just landed and should fix it. Please let me know if it still doesn't compile with the exact error message. Thanks.

martenrichter commented 6 months ago

For what it's worth, our current theory is that this was caused by e521a00, not f0aac12.

Interesting, that was also my theory, but I went through all commits through the history and this was the position where it failed,but it may be the temporal ordering was not the ordering inside the branch.

e521a00 changed Iterator::iterator_category to mark the iterator as random access. This means lookups are O(1), not O(n). std::lower_bound() would benefit from it. However, std::lower_bound() uses std::advance(), which requires a different set of methods to be implemented on the iterator on different platforms. Envoy builds with gcc also failed. d3bc5ff just landed and should fix it. Please let me know if it still doesn't compile with the exact error message. Thanks.

I can confirm that my CI/CD jobs have now succeeded in Linux, so I guess it is fixed. Thank you very much!

bencebeky commented 6 months ago

Thank you for confirming.