monero-project/kovri

Kovri doesn't build with Boost 1.67

btolfa opened this issue · 4 comments


By submitting this issue, I confirm the following:

  • I have read and understood the contributor guide in kovri-docs.
  • I have checked that the issue I am reporting can be replicated or that the feature I am suggesting is not present.
  • I have checked opened or recently closed pull requests for existing solutions/implementations to my issue/suggestion.

Compilers throw the following errors:

MSVC

kovri\src\client\address_book\impl.cc(92): error C2440: '<function-style-cast>': cannot convert from 'kovri::client::AddressBookDefaults::SubscriberTimeout' to 'boost::posix_time::minutes'
kovri\src\client\address_book\impl.cc(94): note: No constructor could take the source type, or constructor overload resolution was ambiguous

clang

kovri\src\client\address_book\impl.cc(92): error: no matching conversion for functional-style cast from 'kovri::client::AddressBookDefaults' to 'boost::posix_time::minutes'

gcc

kovri\src\client\address_book\impl.cc(92): error: no matching function for call to 'boost::posix_time::minutes::minutes(kovri::client::AddressBookDefaults::SubscriberTimeout)'

According to #842 (comment)

In the boost 1.67 the definition of boost::poxis_time::minutes and similar classes changed from

  class BOOST_SYMBOL_VISIBLE minutes : public time_duration
  {
  public:
    explicit minutes(long m) :
      time_duration(0,static_cast<min_type>(m),0)
    {}
};

https://github.com/boostorg/date_time/blob/boost-1.65.1/include/boost/date_time/posix_time/posix_time_duration.hpp#L32

to

  class BOOST_SYMBOL_VISIBLE minutes : public time_duration
  {
  public:
      template <typename T>
      explicit minutes(T const& m,
          typename boost::enable_if<boost::is_integral<T>, void>::type* = 0) :
      time_duration(0, numeric_cast<min_type>(m),0)
    {}
};

https://github.com/boostorg/date_time/blob/boost-1.67.0/include/boost/date_time/posix_time/posix_time_duration.hpp#L39

These changes were done because

  //
  // Note about var_type, which is used to define the variable that
  // stores hours, minutes, and seconds values:
  //
  // In Boost 1.65.1 and earlier var_type was boost::int32_t which suffers
  // the year 2038 problem.  Binary serialization of posix_time uses
  // 32-bit values, and uses serialization version 0.
  //
  // In Boost 1.66.0 the var_type changed to std::time_t, however
  // binary serialization was not properly versioned, so on platforms
  // where std::time_t is 32-bits, it remains compatible, however on
  // platforms where std::time_t is 64-bits, binary serialization ingest
  // will be incompatible with previous versions.  Furthermore, binary
  // serialized output from 1.66.0 will not be compatible with future
  // versions.  Yes, it's a mess.  Static assertions were not present
  // in the serialization code to protect against this possibility.
  //
  // In Boost 1.67.0 the var_type was changed to boost::int64_t, 
  // ensuring the output size is 64 bits, and the serialization version
  // was bumped.  Static assertions were added as well, protecting
  // future changes in this area.

https://github.com/boostorg/date_time/blob/boost-1.67.0/include/boost/date_time/time_resolution_traits.hpp#L64

The enum value causes SFINAE failure because

static_assert(<boost::is_integral<Enum>::value == false);

@btolfa Kovri builds against Boost 1.58, since this is required for Ubuntu x86_64. This can be seen in the failing buildbot check in #856. I'm unaware if there are plans to change the Boost minimal/target version, but I don't believe there are.

@coneiric The failure of buildbot/kovri-all-ubuntu-amd64 isn't caused by these changes or boost.

Assembler messages:
Fatal error: can't create CMakeFiles/kovri-util.dir/cpuid.cc.o: No such file or directory
src/util/CMakeFiles/kovri-util.dir/build.make:254: recipe for target 'src/util/CMakeFiles/kovri-util.dir/cpuid.cc.o' failed

Something is wrong with that buildbot.
Other builds which use boost 1.58 are green - buildbot/kovri-all-ubuntu-i686

@btolfa Sorry about that, also just saw your conversation in another issue about custom FindBoost.cmake for Windows.