compatibility issue when using boost 1.67
seahawk1986 opened this issue · comments
Hello,
boost 1.67 changed the default time type expected for it's socket iostream operations (https://www.boost.org/users/history/version_1_67_0.html):
- Changed socket iostreams to use chrono by default, to fix compatibility with the Networking TS. Define BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM to enable the old Boost.Date_Time interface in basic_socket_streambuf and basic_socket_iostream.
vdr-fritz or rather https://github.com/jowi24/libnetpp fail to build because of that change:
g++ -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -O3 -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I/usr/local/src/vdr-fritzbox/src/fritzbox-1.5.3 -std=c++11 -o TcpClient.o -c TcpClient.cpp
TcpClient.cpp: In Elementfunktion »void network::TcpClient::expireStreamNow()«:
TcpClient.cpp:58:57: Fehler: keine passende Funktion für Aufruf von »boost::asio::basic_socket_iostream<boost::asio::ip::tcp>::expires_from_now(boost::posix_time::seconds)«
stream->expires_from_now(boost::posix_time::seconds(0));
^
In file included from /usr/include/boost/asio.hpp:31,
from TcpClient.h:25,
from TcpClient.cpp:22:
/usr/include/boost/asio/basic_socket_iostream.hpp:392:12: Anmerkung: candidate: »boost::asio::basic_socket_iostream<Protocol, Clock, WaitTraits>::duration boost::asio::basic_socket_iostream<Protocol, Clock, WaitTraits>::expires_from_now() const [with Protocol = boost::asio::ip::tcp; Clock = std::chrono::_V2::steady_clock; WaitTraits = boost::asio::wait_traits<std::chrono::_V2::steady_clock>; boost::asio::basic_socket_iostream<Protocol, Clock, WaitTraits>::duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]«
duration expires_from_now() const
^~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_socket_iostream.hpp:392:12: Anmerkung: Kandidat erwartet 0 Argumente, 1 angegeben
/usr/include/boost/asio/basic_socket_iostream.hpp:407:8: Anmerkung: candidate: »void boost::asio::basic_socket_iostream<Protocol, Clock, WaitTraits>::expires_from_now(const duration&) [with Protocol = boost::asio::ip::tcp; Clock = std::chrono::_V2::steady_clock; WaitTraits = boost::asio::wait_traits<std::chrono::_V2::steady_clock>; boost::asio::basic_socket_iostream<Protocol, Clock, WaitTraits>::duration = std::chrono::duration<long int, std::ratio<1, 1000000000> >]«
void expires_from_now(const duration& expiry_time)
^~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_socket_iostream.hpp:407:8: Anmerkung: keine bekannte Umwandlung für Argument 1 von »boost::posix_time::seconds« nach »const duration&« {aka »const std::chrono::duration<long int, std::ratio<1, 1000000000> >&«}
make[1]: *** [Makefile:9: TcpClient.o] Fehler 1
Defining BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM would allow the code to be compatible with the most recent version of boost without introducing backwards incompatible changes:
--- a/libnet++/TcpClient.cpp
+++ b/libnet++/TcpClient.cpp
@@ -19,6 +19,7 @@
*
*/
+#define BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM
#include "TcpClient.h"
#include <liblog++/Log.h>
Thank you for your contribution! The fix has been added to the master branch and will be included in the next release.