chenshuo / muduo

Event-driven network library for multi-threaded Linux server in C++11
https://github.com/chenshuo/muduo
Other
14.88k stars 5.18k forks source link

Build error #714

Open Gitspike opened 3 months ago

Gitspike commented 3 months ago
[ 24%] Building CXX object muduo/net/CMakeFiles/muduo_net.dir/InetAddress.cc.o
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:50:35: error: expected primary-expression before ‘,’ token
   50 | static_assert(offsetof(sockaddr_in, sin_family) == 0, "sin_family offset 0");
      |                                   ^
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:50:37: error: ‘sin_family’ was not declared in this scope
   50 | static_assert(offsetof(sockaddr_in, sin_family) == 0, "sin_family offset 0");
      |                                     ^~~~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:50:15: error: ‘offsetof’ was not declared in this scope
   50 | static_assert(offsetof(sockaddr_in, sin_family) == 0, "sin_family offset 0");
      |               ^~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:16:1: note: ‘offsetof’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
   15 | #include <netdb.h>
  +++ |+#include <cstddef>
   16 | #include <netinet/in.h>
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:51:36: error: expected primary-expression before ‘,’ token
   51 | static_assert(offsetof(sockaddr_in6, sin6_family) == 0, "sin6_family offset 0");
      |                                    ^
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:51:38: error: ‘sin6_family’ was not declared in this scope
   51 | static_assert(offsetof(sockaddr_in6, sin6_family) == 0, "sin6_family offset 0");
      |                                      ^~~~~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:51:15: error: ‘offsetof’ was not declared in this scope
   51 | static_assert(offsetof(sockaddr_in6, sin6_family) == 0, "sin6_family offset 0");
      |               ^~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:51:15: note: ‘offsetof’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:52:35: error: expected primary-expression before ‘,’ token
   52 | static_assert(offsetof(sockaddr_in, sin_port) == 2, "sin_port offset 2");
      |                                   ^
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:52:37: error: ‘sin_port’ was not declared in this scope; did you mean ‘in_port_t’?
   52 | static_assert(offsetof(sockaddr_in, sin_port) == 2, "sin_port offset 2");
      |                                     ^~~~~~~~
      |                                     in_port_t
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:52:15: error: ‘offsetof’ was not declared in this scope
   52 | static_assert(offsetof(sockaddr_in, sin_port) == 2, "sin_port offset 2");
      |               ^~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:52:15: note: ‘offsetof’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:53:36: error: expected primary-expression before ‘,’ token
   53 | static_assert(offsetof(sockaddr_in6, sin6_port) == 2, "sin6_port offset 2");
      |                                    ^
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:53:38: error: ‘sin6_port’ was not declared in this scope
   53 | static_assert(offsetof(sockaddr_in6, sin6_port) == 2, "sin6_port offset 2");
      |                                      ^~~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:53:15: error: ‘offsetof’ was not declared in this scope
   53 | static_assert(offsetof(sockaddr_in6, sin6_port) == 2, "sin6_port offset 2");
      |               ^~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:53:15: note: ‘offsetof’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc: In constructor ‘muduo::net::InetAddress::InetAddress(uint16_t, bool, bool)’:
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:57:37: error: expected primary-expression before ‘,’ token
   57 |   static_assert(offsetof(InetAddress, addr6_) == 0, "addr6_ offset 0");
      |                                     ^
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:57:17: error: ‘offsetof’ was not declared in this scope
   57 |   static_assert(offsetof(InetAddress, addr6_) == 0, "addr6_ offset 0");
      |                 ^~~~~~~~
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:57:17: note: ‘offsetof’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/spike/projects/self/muduo/muduo/net/InetAddress.cc:58:37: error: expected primary-expression before ‘,’ token
   58 |   static_assert(offsetof(InetAddress, addr_) == 0, "addr_ offset 0");
      |                                     ^
make[2]: *** [muduo/net/CMakeFiles/muduo_net.dir/build.make:174: muduo/net/CMakeFiles/muduo_net.dir/InetAddress.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1765: muduo/net/CMakeFiles/muduo_net.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

环境: Ubuntu22.04

cmake 版本 3.28.1

gcc: gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

boost版本 libboost1.74-dev:amd64

Gitspike commented 3 months ago

添加头文件后上述问题解决,但是遇到了其他编译错误

[ 48%] Building CXX object examples/ace/ttcp/CMakeFiles/ttcp_asio_async.dir/ttcp_asio_async.cc.o
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc: In constructor ‘TtcpServerConnection::TtcpServerConnection(const boost::asio::executor&)’:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7: error: no matching function for call to ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp>::basic_stream_socket(const boost::asio::executor&)’
   29 |     : socket_(executor), count_(0), payload_(NULL), ack_(0)
      |       ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/basic_stream_socket.hpp:292:3: note: candidate: ‘template<class Protocol1, class Executor1> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(boost::asio::basic_stream_socket<Protocol1, Executor1>&&, typename std::enable_if<(std::is_convertible<Protocol1, Protocol>::value && std::is_convertible<_Ep, _Dp>::value)>::type*) [with Protocol1 = Protocol1; Executor1 = Executor1; Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  292 |   basic_stream_socket(basic_stream_socket<Protocol1, Executor1>&& other,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:292:3: note:   template argument deduction/substitution failed:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7: note:   types ‘boost::asio::basic_stream_socket<Protocol1, Executor1>’ and ‘const boost::asio::executor’ have incompatible cv-qualifiers
   29 |     : socket_(executor), count_(0), payload_(NULL), ack_(0)
      |       ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/basic_stream_socket.hpp:236:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const protocol_type&, const native_handle_type&, typename std::enable_if<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type*) [with ExecutionContext = ExecutionContext; Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  236 |   basic_stream_socket(ExecutionContext& context,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:236:3: note:   template argument deduction/substitution failed:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7: note:   candidate expects 4 arguments, 1 provided
   29 |     : socket_(executor), count_(0), payload_(NULL), ack_(0)
      |       ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/basic_stream_socket.hpp:192:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const endpoint_type&, typename std::enable_if<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type*) [with ExecutionContext = ExecutionContext; Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  192 |   basic_stream_socket(ExecutionContext& context, const endpoint_type& endpoint,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:192:3: note:   template argument deduction/substitution failed:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7: note:   candidate expects 3 arguments, 1 provided
   29 |     : socket_(executor), count_(0), payload_(NULL), ack_(0)
      |       ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/basic_stream_socket.hpp:147:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const protocol_type&, typename std::enable_if<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type*) [with ExecutionContext = ExecutionContext; Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  147 |   basic_stream_socket(ExecutionContext& context, const protocol_type& protocol,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:147:3: note:   template argument deduction/substitution failed:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7: note:   candidate expects 3 arguments, 1 provided
   29 |     : socket_(executor), count_(0), payload_(NULL), ack_(0)
      |       ^~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:33,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/basic_stream_socket.hpp:108:12: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, typename std::enable_if<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type*) [with ExecutionContext = ExecutionContext; Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  108 |   explicit basic_stream_socket(ExecutionContext& context,
      |            ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:108:12: note:   template argument deduction/substitution failed:
/usr/include/boost/asio/basic_stream_socket.hpp: In substitution of ‘template<class ExecutionContext> boost::asio::basic_stream_socket<boost::asio::ip::tcp>::basic_stream_socket(ExecutionContext&, typename std::enable_if<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type*) [with ExecutionContext = const boost::asio::executor]’:
/home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:29:7:   required from here
/usr/include/boost/asio/basic_stream_socket.hpp:108:12: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’
/usr/include/boost/asio/basic_stream_socket.hpp:257:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(boost::asio::basic_stream_socket<Protocol, Executor>&&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
  257 |   basic_stream_socket(basic_stream_socket&& other) BOOST_ASIO_NOEXCEPT
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:257:45: note:   no known conversion for argument 1 from ‘const boost::asio::executor’ to ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp>&&’
  257 |   basic_stream_socket(basic_stream_socket&& other) BOOST_ASIO_NOEXCEPT
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:214:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const protocol_type&, const native_handle_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::executor_type = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::protocol_type = boost::asio::ip::tcp; boost::asio::basic_stream_socket<Protocol, Executor>::native_handle_type = int]’
  214 |   basic_stream_socket(const executor_type& ex,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:214:3: note:   candidate expects 3 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:170:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const endpoint_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::executor_type = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::endpoint_type = boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>]’
  170 |   basic_stream_socket(const executor_type& ex, const endpoint_type& endpoint)
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:170:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:128:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const protocol_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::executor_type = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::protocol_type = boost::asio::ip::tcp]’
  128 |   basic_stream_socket(const executor_type& ex, const protocol_type& protocol)
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:128:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:92:12: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; boost::asio::basic_stream_socket<Protocol, Executor>::executor_type = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >]’
   92 |   explicit basic_stream_socket(const executor_type& ex)
      |            ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:92:53: note:   no known conversion for argument 1 from ‘const boost::asio::executor’ to ‘const executor_type&’ {aka ‘const boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >&’}
   92 |   explicit basic_stream_socket(const executor_type& ex)
      |                                ~~~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/boost/asio/executor.hpp:342,
                 from /usr/include/boost/asio.hpp:86,
                 from /home/spike/projects/self/muduo/examples/ace/ttcp/ttcp_asio_async.cc:4:
/usr/include/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::on_work_started() [with Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; Allocator = std::allocator<void>]’:
/usr/include/boost/asio/impl/executor.hpp:77:8:   required from here
/usr/include/boost/asio/impl/executor.hpp:79:15: error: ‘class boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >’ has no member named ‘on_work_started’
   79 |     executor_.on_work_started();
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~
/usr/include/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::on_work_finished() [with Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; Allocator = std::allocator<void>]’:
/usr/include/boost/asio/impl/executor.hpp:82:8:   required from here
/usr/include/boost/asio/impl/executor.hpp:84:15: error: ‘class boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >’ has no member named ‘on_work_finished’
   84 |     executor_.on_work_finished();
      |     ~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::dispatch(boost::asio::executor::function&&) [with Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; Allocator = std::allocator<void>; boost::asio::executor::function = boost::asio::detail::executor_function]’:
/usr/include/boost/asio/impl/executor.hpp:92:8:   required from here
/usr/include/boost/asio/impl/executor.hpp:94:15: error: ‘class boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >’ has no member named ‘dispatch’
   94 |     executor_.dispatch(BOOST_ASIO_MOVE_CAST(function)(f), allocator_);
      |     ~~~~~~~~~~^~~~~~~~
/usr/include/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::post(boost::asio::executor::function&&) [with Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; Allocator = std::allocator<void>; boost::asio::executor::function = boost::asio::detail::executor_function]’:
/usr/include/boost/asio/impl/executor.hpp:97:8:   required from here
/usr/include/boost/asio/impl/executor.hpp:99:15: error: ‘class boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >’ has no member named ‘post’
   99 |     executor_.post(BOOST_ASIO_MOVE_CAST(function)(f), allocator_);
      |     ~~~~~~~~~~^~~~
/usr/include/boost/asio/impl/executor.hpp: In instantiation of ‘void boost::asio::executor::impl< <template-parameter-1-1>, <template-parameter-1-2> >::defer(boost::asio::executor::function&&) [with Executor = boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >; Allocator = std::allocator<void>; boost::asio::executor::function = boost::asio::detail::executor_function]’:
/usr/include/boost/asio/impl/executor.hpp:102:8:   required from here
/usr/include/boost/asio/impl/executor.hpp:104:15: error: ‘class boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >’ has no member named ‘defer’; did you mean ‘prefer’?
  104 |     executor_.defer(BOOST_ASIO_MOVE_CAST(function)(f), allocator_);
      |     ~~~~~~~~~~^~~~~
      |     prefer
make[2]: *** [examples/ace/ttcp/CMakeFiles/ttcp_asio_async.dir/build.make:76: examples/ace/ttcp/CMakeFiles/ttcp_asio_async.dir/ttcp_asio_async.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2526: examples/ace/ttcp/CMakeFiles/ttcp_asio_async.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

猜测可能与boost版本有关?

Gitspike commented 3 months ago

已提pr https://github.com/chenshuo/muduo/pull/715