zeromq / azmq

C++ language binding library integrating ZeroMQ with Boost Asio
Boost Software License 1.0
319 stars 109 forks source link

the code use deprecated interfaces of boost::asio #184

Open ClausKlein opened 3 years ago

ClausKlein commented 3 years ago

with modern boost version, it does not compile:

bash-3.2$ builddriver make
builddriver executing: 'make'
Compilation FAILED in 2.877182 seconds
Number of warnings: 0
Number of errors: 111
Last Error:
  Message: "no viable conversion from returned value of type 'void' to function return type 'boost::system::error_code'"
  Path: /Users/clausklein/Workspace/c/libzmq/examples/azmq/azmq/detail/socket_ops.hpp
  Line Number: 119
  Column: 20
For full log, please open: /var/folders/wb/ckvxxgls5db7qyhqq4y5_l1c0000gq/T/build-d29l5xbh.log
bash-3.2$

build-d29l5xbh.log

ClausKlein commented 3 years ago

To reproduce the problem see https://github.com/ClausKlein/azmq/blob/feature/BOOST_ASIO_NO_DEPRECATED/CMakeLists.txt

aboseley commented 3 years ago

It compiles with the latest boost version 1.76, but when you flick on BOOST_ASIO_NO_DEPRECATED, I think it removes the deprecated interfaces, so it not surprising it bombs. I assume we could fix this but then we'll probably have to raise the minimum boost version - I'm not sure if this would affect azmq users? Perhaps its reasonably to only support boost and zmq version from the last two years. Thoughts?

ClausKlein commented 3 years ago

Starting with v1.71, boost is installed with cmake config packages, which can used as noted in my TODO: lines. debian stable still delivers an older boost version, but it supports this option too!

The BOOST_ASIO_NO_DEPRECATED is available since c++17 is finished.

IMHO, it should not activated at the moment, because of the this azmq interface:

         template<typename T>
         T const& buffer_cast() const {
              return *boost::asio::buffer_cast<T const*>(buffer()); // FIXME: deprecated! CK
         }

The lastes ZMQ4 git version export a cmake config packages too, but this is no available on GitHub CI?

I would prefer to use it like this:

find_package(ZeroMQ 4.3 CONFIG REQUIRED) 
target_link_libraries(azmq INTERFACE ZeroMQ::libzmq Boost::thread)

but the namespace is missing in ZMQ4?

ClausKlein commented 3 years ago

I have modernise so far the code to use the std asio interfaces were possible. This compiles without any warning, clang-tidyis happy, but the are test errors?

It needs more love ...

see too https://github.com/ClausKlein/azmq/pull/1

sweemer commented 5 months ago

IMHO, it should not activated at the moment, because of the this azmq interface:

I would recommend that either that azmq interface be deprecated as well, or find a way to implement it without using the deprecated asio function.

Removing BOOST_ASIO_NO_DEPRECATED from my build configs to satisfy azmq does not seem like a good solution.