azmq icon indicating copy to clipboard operation
azmq copied to clipboard

Fails to build with Asio 1.33.0 / Boost 1.87

Open cmorve-te opened this issue 1 year ago • 2 comments

As can be seen in https://www.boost.org/doc/libs/1_87_0/doc/html/boost_asio/history.html a bunch of deprecated facilities of ASIO have finally been removed, meaning AZMQ doesn't build any more.

I have not checked how difficult it's to fix. But at the very least "Removed deprecated alias io_service" breaks mostly everything.

cmorve-te avatar Jan 09 '25 12:01 cmorve-te

I got most of it working on boost 1.87 but I'm not 100% sure how backwards compatible it is 😅

Also for some reason I can't get the coroutine tests working on 1.87

https://github.com/jp-pino/azmq

jp-pino avatar Jan 23 '25 11:01 jp-pino

Also for some reason I can't get the coroutine tests working on 1.87

Without even looking at those tests, could it be this (from the ASIO changelog)

Removed Boost.Coroutine-based spawn() overloads. The spawn() function now works only with the fiber support in Boost.Context.

cmorve-te avatar Jan 23 '25 11:01 cmorve-te

This issue is becoming increasingly painful as more distros move to newer boost versions.

panicgh avatar May 19 '25 20:05 panicgh

I've started a PR to try to get my changes merged. Looks like it's working for most Ubuntu/Boost combinations.

jp-pino avatar Sep 01 '25 10:09 jp-pino

Also for some reason I can't get the coroutine tests working on 1.87

In recent Boost.Asio versions, boost::asio::spawn has a third parameter for the completion token. If you don’t supply it, it defaults to boost::asio::deferred, which returns a value that’s marked [[nodiscard]].

Seems like explicitly passing boost::asio::detached as third parameter to boost::asio::spawn (which tells Asio “fire and forget”) fixes "Async Operation Send/Receive with stackful coroutine" test.

might need #include <boost/asio/detached.hpp>

Oh, and there are a few more tests which use boost::asio::spawn. Their checks are done inside completion handlers but those are probably never called. So those tests can't fail but they probably don't test anything with Boost 1.87. So they also seem to need boost::asio::deferred (which should also silence compiler warnings about not using [[nodiscard]] value 😁)

jacekzzzz avatar Sep 16 '25 08:09 jacekzzzz

I decided on using boost::asio::use_future as it triggers the execution immediately and verified that the future completes at the end of the test. This way we also make sure that the validations inside the lambda are executed as well.

It's working for ubuntu-22.04 and ubuntu-24.04 for Boost versions 1.68 through 1.89

jp-pino avatar Sep 24 '25 15:09 jp-pino