facebook / mvfst

An implementation of the QUIC transport protocol.
MIT License
1.5k stars 242 forks source link

Linux compilation breaking in folly io_uring #266

Closed moderation closed 2 years ago

moderation commented 2 years ago

For this week compilation on Linux is breaking on the folly io_uring code. I've tried with gcc 12 and clang 14.0.6 and experimenting with -std=gnu++20 and -std=c++20 flags. Any ideas?

image

/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:548:18: error: non-type template parameters of class type only available with ‘-std=c++20’ or ‘-std=gnu++20’
  548 | template <class T...>
      |                  ^~~
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:549:17: error: ‘ProvidedBufferRing’ was not declared in this scope
  549 | std::unique_ptr<ProvidedBufferRing> makeProvidedBufferRing() {
      |                 ^~~~~~~~~~~~~~~~~~
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:549:35: error: template argument 1 is invalid
  549 | std::unique_ptr<ProvidedBufferRing> makeProvidedBufferRing() {
      |                                   ^
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:549:35: error: template argument 2 is invalid
[  5%] Building CXX object CMakeFiles/folly_base.dir/folly/external/farmhash/farmhash.cpp.o
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In constructor ‘folly::IoUringBackend::IoUringBackend(Options)’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:734:22: error: ‘IORING_SETUP_COOP_TASKRUN’ was not declared in this scope
  734 |     params_.flags |= IORING_SETUP_COOP_TASKRUN;
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In lambda function:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:774:11: error: ‘io_uring_register_ring_fd’ was not declared in this scope; did you mean ‘io_uring_register_eventfd’?
  774 |       if (io_uring_register_ring_fd(&ioRing_) < 0) {
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~
      |           io_uring_register_eventfd
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In constructor ‘folly::IoUringBackend::IoUringBackend(Options)’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:827:45: error: no matching function for call to ‘makeProvidedBufferRing(folly::IoUringBackend*, uint16_t, size_t&, int&, int&)’
  827 |     bufferProvider_ = makeProvidedBufferRing(
      |                       ~~~~~~~~~~~~~~~~~~~~~~^
  828 |         this,
      |         ~~~~~                                
  829 |         nextBufferProviderGid(),
      |         ~~~~~~~~~~~~~~~~~~~~~~~~             
  830 |         options.initalProvidedBuffersCount,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  831 |         sizeShift,
      |         ~~~~~~~~~~                           
  832 |         ringShift);
      |         ~~~~~~~~~~                           
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:549:37: note: candidate: ‘template<<typeprefixerror>...<anonymous> > int folly::{anonymous}::makeProvidedBufferRing()’
  549 | std::unique_ptr<ProvidedBufferRing> makeProvidedBufferRing() {
      |                                     ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:549:37: note:   template argument deduction/substitution failed:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:827:45: note:   candidate expects 0 arguments, 5 provided
  827 |     bufferProvider_ = makeProvidedBufferRing(
      |                       ~~~~~~~~~~~~~~~~~~~~~~^
  828 |         this,
      |         ~~~~~                                
  829 |         nextBufferProviderGid(),
      |         ~~~~~~~~~~~~~~~~~~~~~~~~             
  830 |         options.initalProvidedBuffersCount,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  831 |         sizeShift,
      |         ~~~~~~~~~~                           
  832 |         ringShift);
      |         ~~~~~~~~~~                           
[  5%] Building CXX object CMakeFiles/folly_base.dir/folly/fibers/BatchSemaphore.cpp.o
[  6%] Building CXX object CMakeFiles/folly_base.dir/folly/fibers/Baton.cpp.o
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In member function ‘void folly::IoUringBackend::cancel(IoSqeBase*)’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:1474:3: error: ‘io_uring_prep_cancel64’ was not declared in this scope; did you mean ‘io_uring_prep_cancel’?
 1474 |   io_uring_prep_cancel64(sqe, (uint64_t)ioSqe, 0);
      |   ^~~~~~~~~~~~~~~~~~~~~~
      |   io_uring_prep_cancel
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:1476:26: error: ‘IORING_FEAT_CQE_SKIP’ was not declared in this scope; did you mean ‘IORING_FEAT_NODROP’?
 1476 |   if (params_.features & IORING_FEAT_CQE_SKIP) {
      |                          ^~~~~~~~~~~~~~~~~~~~
      |                          IORING_FEAT_NODROP
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:1477:19: error: ‘IOSQE_CQE_SKIP_SUCCESS’ was not declared in this scope
 1477 |     sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
      |                   ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In member function ‘bool folly::IoUringBackend::kernelHasNonBlockWriteFixes() const’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:1830:29: error: ‘IORING_FEAT_LINKED_FILE’ was not declared in this scope
 1830 |   return params_.features & IORING_FEAT_LINKED_FILE;
      |                             ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/container/F14Map.h:42,
                 from /home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:23:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/container/detail/F14Policy.h: In instantiation of ‘folly::f14::detail::VectorContainerPolicy<Key, MappedTypeOrVoid, HasherOrVoid, KeyEqualOrVoid, AllocOrVoid, EligibleForPerturbedInsertionOrder>::Iter folly::f14::detail::VectorContainerPolicy<Key, MappedTypeOrVoid, HasherOrVoid, KeyEqualOrVoid, AllocOrVoid, EligibleForPerturbedInsertionOrder>::makeIter(const ItemIter&) const [with Key = std::__cxx11::basic_string<char>; MappedTypeOrVoid = folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo; HasherOrVoid = void; KeyEqualOrVoid = void; AllocOrVoid = void; EligibleForPerturbedInsertionOrder = std::integral_constant<bool, true>; Iter = folly::f14::detail::VectorContainerIterator<std::pair<const std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo>*>; ItemIter = folly::f14::detail::F14ItemIter<folly::f14::detail::F14Chunk<unsigned int>*>]’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/container/F14Map.h:690:27:   required from ‘folly::f14::detail::F14BasicMap<Policy>::iterator folly::f14::detail::F14BasicMap<Policy>::find(const key_type&) [with Policy = folly::f14::detail::VectorContainerPolicy<std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo, void, void, void, std::integral_constant<bool, true> >; iterator = folly::f14::detail::VectorContainerIterator<std::pair<const std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo>*>; key_type = std::__cxx11::basic_string<char>]’
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:231:26:   required from here
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/container/detail/F14Policy.h:1450:42: warning: comparing the result of pointer addition ‘(((folly::f14::detail::VectorContainerPolicy<std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo, void, void, void, std::integral_constant<bool, true> >::ValuePtr)((const folly::f14::detail::VectorContainerPolicy<std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo, void, void, void, std::integral_constant<bool, true> >*)this)->folly::f14::detail::VectorContainerPolicy<std::__cxx11::basic_string<char>, folly::{anonymous}::SQGroupInfoRegistry::SQGroupInfo, void, void, void, std::integral_constant<bool, true> >::values_) + ((sizetype)(((long unsigned int)(& underlying)->folly::f14::detail::F14ItemIter<folly::f14::detail::F14Chunk<unsigned int>*>::item()) * 128)))’ and NULL [-Waddress]
 1450 |       assume(values_ + underlying.item() != nullptr);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
[  6%] Building CXX object CMakeFiles/folly_base.dir/folly/fibers/Fiber.cpp.o
[  6%] Building CXX object CMakeFiles/folly_base.dir/folly/fibers/FiberManager.cpp.o
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp: In member function ‘void folly::{anonymous}::SignalRegistry::notify(int)’:
/home/<user>/Downloads/proxygen/proxygen/_build/deps/folly/folly/experimental/io/IoUringBackend.cpp:81:14: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   81 |       ::write(fd, &sigNum, 1);
      |       ~~~~~~~^~~~~~~~~~~~~~~~
[  7%] Building CXX object CMakeFiles/folly_base.dir/folly/fibers/GuardPageAllocator.cpp.o
make[2]: *** [CMakeFiles/folly_base.dir/build.make:1686: CMakeFiles/folly_base.dir/folly/experimental/io/IoUringBackend.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:145: CMakeFiles/folly_base.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
lnicco commented 2 years ago

@moderation this looks like a folly issue, I can try to reproduce, but in the meantime would you mind opening the same Issue on the folly repo so that it gets the right eyes on it?

kvtsoy commented 2 years ago

@moderation does this build now that folly issue is resolved?

moderation commented 2 years ago

Yes! Successfully building now. Comment is at https://github.com/facebook/folly/issues/1832#issuecomment-1217161687. Thanks again