Skip to content

failed compile on boost 1.67 - posix_time and time_durations, native_handle #72

Closed
@russkel

Description

@russkel

Issue when compiling with:

$ apk info boost-dev
boost-dev-1.67.0-r2 description:
Free peer-reviewed portable C++ source libraries (development files)
[ 64%] Building CXX object src/acomms/CMakeFiles/goby_acomms.dir/queue/queue_manager.cpp.o
/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/queue/queue_manager.cpp: In member function 'goby::acomms::Queue* goby::acomms::QueueManager::find_next_sender(const goby::acomms::protobuf::ModemTransmission&, const string&, bool)':
/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/queue/queue_manager.cpp:547:88: error: no matching function for call to 'boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>::subsecond_duration(double)'
                                                     cfg_.on_demand_skew_seconds() * 1e6) <
                                                                                        ^
In file included from /usr/include/boost/date_time/posix_time/posix_time_config.hpp:16,
                 from /usr/include/boost/date_time/posix_time/posix_time_system.hpp:13,
                 from /usr/include/boost/date_time/posix_time/ptime.hpp:12,
                 from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:12,
                 from /usr/include/boost/thread/thread_time.hpp:11,
                 from /usr/include/boost/thread/lock_types.hpp:18,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread_only.hpp:17,
                 from /usr/include/boost/thread/thread.hpp:12,
                 from /usr/include/boost/thread.hpp:13,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger/flex_ostreambuf.h:33,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger/flex_ostream.h:35,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger.h:28,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/queue/queue_manager.cpp:25:
/usr/include/boost/date_time/time_duration.hpp:285:14: note: candidate: 'template<class T> boost::date_time::subsecond_duration<base_duration, frac_of_second>::subsecond_duration(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*)'
     explicit subsecond_duration(T const& ss,
              ^~~~~~~~~~~~~~~~~~
/usr/include/boost/date_time/time_duration.hpp:285:14: note:   template argument deduction/substitution failed:
/usr/include/boost/date_time/time_duration.hpp: In substitution of 'template<class T> boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>::subsecond_duration(const T&, typename boost::enable_if<boost::is_integral<T>, void>::type*) [with T = double]':
/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/queue/queue_manager.cpp:547:88:   required from here
/usr/include/boost/date_time/time_duration.hpp:285:14: error: no type named 'type' in 'struct boost::enable_if<boost::is_integral<double>, void>'
In file included from /usr/include/boost/date_time/posix_time/posix_time_config.hpp:16,
                 from /usr/include/boost/date_time/posix_time/posix_time_system.hpp:13,
                 from /usr/include/boost/date_time/posix_time/ptime.hpp:12,
                 from /usr/include/boost/date_time/posix_time/posix_time_types.hpp:12,
                 from /usr/include/boost/thread/thread_time.hpp:11,
                 from /usr/include/boost/thread/lock_types.hpp:18,
                 from /usr/include/boost/thread/pthread/thread_data.hpp:12,
                 from /usr/include/boost/thread/thread_only.hpp:17,
                 from /usr/include/boost/thread/thread.hpp:12,
                 from /usr/include/boost/thread.hpp:13,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger/flex_ostreambuf.h:33,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger/flex_ostream.h:35,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/build/include/goby/common/logger.h:28,
                 from /apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/queue/queue_manager.cpp:25:
/usr/include/boost/date_time/time_duration.hpp:270:30: note: candidate: 'boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>::subsecond_duration(const boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>&)'
   class BOOST_SYMBOL_VISIBLE subsecond_duration : public base_duration
                              ^~~~~~~~~~~~~~~~~~
/usr/include/boost/date_time/time_duration.hpp:270:30: note:   no known conversion for argument 1 from 'double' to 'const boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>&'
/usr/include/boost/date_time/time_duration.hpp:270:30: note: candidate: 'boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>::subsecond_duration(boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>&&)'
/usr/include/boost/date_time/time_duration.hpp:270:30: note:   no known conversion for argument 1 from 'double' to 'boost::date_time::subsecond_duration<boost::posix_time::time_duration, 1000000>&&'
make[2]: *** [src/acomms/CMakeFiles/goby_acomms.dir/build.make:277: src/acomms/CMakeFiles/goby_acomms.dir/queue/queue_manager.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:377: src/acomms/CMakeFiles/goby_acomms.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
>>> ERROR: goby: build failed

It seems boost no longer permits floating point numbers to initialise posix_time objects. If we cast these to long will there be much precision loss?

Also goby::acomms::MACManager::next_cycle_time() function seems to have numerous conversions to microseconds through out the function, some using double and some using int64. Perhaps this could be refactored?

Related issue I could find: PointCloudLibrary/pcl#2422

Activity

changed the title failed compile on boost 1.67 - timedurations failed compile on boost 1.67 - posix_time and time_durations on May 2, 2019
russkel

russkel commented on May 2, 2019

@russkel
ContributorAuthor

In addition there is also this:

/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/modemdriver/mm_driver.cpp: In member function 'virtual void goby::acomms::MMDriver::startup(const goby::acomms::protobuf::DriverConfig&)':
/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/modemdriver/mm_driver.cpp:114:74: error: 'class boost::asio::serial_port' has no member named 'native'
         serial_fd_ = dynamic_cast<util::SerialClient&>(modem()).socket().native();
                                                                          ^~~~~~
make[2]: *** [src/acomms/CMakeFiles/goby_acomms.dir/build.make:329: src/acomms/CMakeFiles/goby_acomms.dir/modemdriver/mm_driver.cpp.o] Error 1

/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/modemdriver/iridium_driver.cpp: In member function 'void goby::acomms::IridiumDriver::modem_init()':
/apk_src/goby/src/goby3-3.0.0_alpha17/src/acomms/modemdriver/iridium_driver.cpp:97:78: error: 'class boost::asio::serial_port' has no member named 'native'
             serial_fd_ = dynamic_cast<util::SerialClient&>(modem()).socket().native();
                                                                              ^~~~~~
make[2]: *** [src/acomms/CMakeFiles/goby_acomms.dir/build.make:368: src/acomms/CMakeFiles/goby_acomms.dir/modemdriver/iridium_driver.cpp.o] Error 1

It seems it is now native_handle.
https://www.boost.org/doc/libs/1_67_0/doc/html/boost_asio/reference/basic_datagram_socket/native_handle.html

changed the title failed compile on boost 1.67 - posix_time and time_durations failed compile on boost 1.67 - posix_time and time_durations, native_handle on May 2, 2019
tsaubergine

tsaubergine commented on May 2, 2019

@tsaubergine
Member

Thanks, oldest boost we're supporting now is 1.58.0 so this should be no problem.

tsaubergine

tsaubergine commented on May 2, 2019

@tsaubergine
Member

Also goby::acomms::MACManager::next_cycle_time() function seems to have numerous conversions to microseconds through out the function, some using double and some using int64. Perhaps this could be refactored?

Almost certainly. I'd like to move everything over to the time3.h functions which use a mix of boost::units and posix_time. C++20 should finally bring dates to std::chrono but we're not there yet...

I opened an issue on this: #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      failed compile on boost 1.67 - posix_time and time_durations, native_handle · Issue #72 · GobySoft/goby3