Project

General

Profile

Actions

Bug #4584

closed

basic_socket_iostream::expires_from_now causes build failure with Boost 1.67

Added by Junxiao Shi over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Immediate
Category:
Tools
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

boost::asio::basic_socket_iostream::expires_from_now is deprecated in favor of expires_after since Boost 1.66.
Compilation of ndn-cxx/tools/ndnsec/cert-dump.cpp is failing with Boost 1.67.


Related issues 1 (0 open1 closed)

Blocks NFD - Task #4564: Release 0.6.2ClosedAlex Afanasyev05/04/2018

Actions
Actions #1

Updated by Junxiao Shi over 6 years ago

  • Assignee set to Davide Pesavento
  • Priority changed from Normal to Immediate
  • Start date deleted (04/17/2018)

Assigning to Davide who wrote the offending line.
Please fix quickly as ndn-cxx won't compile because of this.

Actions #2

Updated by Davide Pesavento over 6 years ago

Junxiao Shi wrote:

Assigning to Davide who wrote the offending line.

Learn how to use git before blaming people. That code was already there, I simply changed from milliseconds(3000) to seconds(3).

Actions #3

Updated by Davide Pesavento over 6 years ago

Junxiao Shi wrote:

boost::asio::basic_socket_iostream::expires_from_now is deprecated in favor of expires_after since Boost 1.66.

This is not even the reason for the compile failure. See the actual error below.

../tools/ndnsec/cert-dump.cpp:178:21: error: no matching member function for call to 'expires_from_now'
      requestStream.expires_from_now(boost::posix_time::seconds(3));
      ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/local/include/boost/asio/basic_socket_iostream.hpp:407:8: note: candidate function not viable: no known conversion from 'boost::posix_time::seconds' to 'const duration' (aka 'const duration<long long, ratio<1LL, 1000000000LL> >') for 1st argument
  void expires_from_now(const duration& expiry_time)
       ^
/usr/local/include/boost/asio/basic_socket_iostream.hpp:392:12: note: candidate function not viable: requires 0 arguments, but 1 was provided
  duration expires_from_now() const
           ^
1 error generated.
Actions #4

Updated by Davide Pesavento over 6 years ago

Actions #5

Updated by Davide Pesavento over 6 years ago

  • Subject changed from basic_socket_iostream::expires_from_now is deprecated, causing build failure with Boost 1.67 to basic_socket_iostream::expires_from_now causes build failure with Boost 1.67
Actions #7

Updated by Davide Pesavento over 6 years ago

  • Status changed from New to Code review
  • % Done changed from 0 to 100
Actions #8

Updated by Davide Pesavento over 6 years ago

Asio has a bug in 1.67, the following fails to compile:

#include <boost/asio/ts/netfwd.hpp>
#include <boost/asio/ip/tcp.hpp>

void foo()
{
  boost::asio::ip::tcp::iostream s;
}
In file included from ../src/foo.cpp:2:
In file included from /usr/local/include/boost/asio/ip/tcp.hpp:20:
In file included from /usr/local/include/boost/asio/basic_socket_iostream.hpp:24:
In file included from /usr/local/include/boost/asio/basic_socket_streambuf.hpp:44:
In file included from /usr/local/include/boost/asio/steady_timer.hpp:22:
In file included from /usr/local/include/boost/asio/basic_waitable_timer.hpp:33:
/usr/local/include/boost/asio/detail/chrono_time_traits.hpp:41:32: error: no type named 'duration' in 'boost::posix_time::ptime'
  typedef typename clock_type::duration duration_type;
          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/usr/local/include/boost/asio/basic_socket_streambuf.hpp:201:20: note: in instantiation of template class 'boost::asio::detail::chrono_time_traits<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> >' requested here
  typedef typename traits_helper::time_type time_type;
                   ^
/usr/local/include/boost/asio/basic_socket_iostream.hpp:117:45: note: in instantiation of template class 'boost::asio::basic_socket_streambuf<boost::asio::ip::tcp, boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> >' requested here
    Clock, WaitTraits BOOST_ASIO_SVC_TARG1> streambuf_;
                                            ^
/usr/local/include/boost/asio/basic_socket_iostream.hpp:154:13: note: in instantiation of template class 'boost::asio::detail::socket_iostream_base<boost::asio::ip::tcp, boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> >' requested here
  : private detail::socket_iostream_base<Protocol
            ^
../src/foo.cpp:6:34: note: in instantiation of template class 'boost::asio::basic_socket_iostream<boost::asio::ip::tcp, boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> >' requested here
  boost::asio::ip::tcp::iostream s;
                                 ^
In file included from ../src/foo.cpp:2:
In file included from /usr/local/include/boost/asio/ip/tcp.hpp:20:
In file included from /usr/local/include/boost/asio/basic_socket_iostream.hpp:24:
In file included from /usr/local/include/boost/asio/basic_socket_streambuf.hpp:44:
In file included from /usr/local/include/boost/asio/steady_timer.hpp:22:
In file included from /usr/local/include/boost/asio/basic_waitable_timer.hpp:33:
/usr/local/include/boost/asio/detail/chrono_time_traits.hpp:44:32: error: no type named 'time_point' in 'boost::posix_time::ptime'
  typedef typename clock_type::time_point time_type;
          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
2 errors generated.

This can impact all applications that use tcp::iostream AND directly or indirectly include <ndn-cxx/net/asio-fwd.hpp>. One example of affected application is ndn-autoconfig.

Actions #9

Updated by Davide Pesavento over 6 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF