-
Notifications
You must be signed in to change notification settings - Fork 114
Fix for Boost >= 1.87 #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The failure that's happening with Ubuntu + Boost 1.70 might be expected: boostorg/thread#297. I think you'll see that with any version of Boost between 1.69 and 1.72. Some of the macOS errors are caused by an incompatibility with Clang that was fixed in Boost 1.81: boostorg/numeric_conversion@50a1eae |
|
Anecdotally, I can say that I also haven't had any issues with these changes on Windows 11 with Boost 1.89. The only problem I've had, which is an existing issue in the master branch, is that the async functions added in #195 don't compile when using some newer Asio completion token types. For example, It looks like Asio's async operations now use the return type of template<class CompletionToken, class ConstBufferSequence>
auto async_send(azmq::socket &socket, ConstBufferSequence const &buffers, CompletionToken &&token)
-> decltype(
boost::asio::async_initiate<CompletionToken, void(boost::system::error_code, size_t)>(
std::declval<async_send_initiation<ConstBufferSequence>>(), token))I don't know if this necessarily needs to be fixed in this PR, but it's worth noting. |
|
The branch was getting too polluted with my attempts at making it work for all versions so I cleaned it up a little.
I've given up on getting it to work for 1.70 because of the issues commented by @cbrl. The point of the PR is not to fix Boost, so I guess that's something we can live with. One of the breaking changes is the deprecation of A simple solution is to use: # OLD behavior is to use the FindBoost module from cmake
# NEW behavior is to use the Boost CMake provided config files
# Boost 1.70 and above can use the new behavior
if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()This however will make all builds for Boost < 1.70 fail. Currently I'm manually specifying in the tests which version of the Policy to use with The policy does specify that in future versions of cmake the |
@cbrl Should we then test on macOS only from 1.81 onwards? |
Probably. That specific error I linked to happens in Clang 16+, so only starting with macOS 15. However, macOS versions <15 still have other various compile errors in earlier versions of the Boost libraries. |
|
@jp-pino . Thank you for the pull request. I also wanted to take a look at this before v1.90 of boost releases. From your pull request boost version >= 1.68 is going to be supported, should we not just use |
Instead of changing all references in the code to #pragma once
#include <boost/version.hpp>
#if BOOST_VERSION >= 108700
#include <boost/asio/io_context.hpp>
namespace boost::asio {
typedef io_context io_service;
}
#else
#include <boost/asio/io_service.hpp>
#endifBut I agree that since I think I'll keep the file, but change it around to Also notices that in some places we're using this pattern: #ifdef AZMQ_DETAIL_USE_IO_SERVICE
actor_service(boost::asio::io_service & ios)
#else
actor_service(boost::asio::io_context & ios)
#endif We can probably also get rid of this and rely on the typedef. But guess we have to keep it for cases were we do this: #ifdef AZMQ_DETAIL_USE_IO_SERVICE
return make_pipe(get_io_service(), defer_start, std::forward<T>(data));
#else
return make_pipe(get_io_context(), defer_start, std::forward<T>(data));
#endif |
Thinking about this about further, I'm only testing Boost 1.68 onwards because azmq has been requiring this version for 3 years now (this is in master): Lines 22 to 29 in 4e8f18b
I guess we can just use |
* Refactor io_service to io_context across the codebase for Boost compatibility * Test against Boost 1.65 * Replace io_context.hpp with Boost's asio/io_context.hpp and update references across the codebase * Remove testing against versions lower than 1.68 * Refactor documentation to reflect use of io_context * Refactor code and documentation to reflect use of io_context
|
I've refactored the code to move away from I took the liberty of dropping some of the checks for |
|
@aboseley @ACvanWyk I was trying on another branch to patch older boost versions to get them compiling with very little success. I think it's beyond the scope of this PR to try to patch/fix old boost versions, and installing older gcc/clang might also be a bit of a pain. |
The actor test is multithreaded. I think there's a race condition that might trigger sometimes, where btb could result in still having the old value (0). I'm using std::future to make sure that the value is updated properly before testing it.
I agree. I think it would be better to cleanup it up now and get rid of the
That makes sense it. I don't think it is worth the effort to try and fix boost. Thank you for taking the time to add this PR. This looks good to me. |
|
I think there's some sort of race condition in the actor test, as the test fails sporadically. I tried to fix it with 0025c0c but seems like it's still failing sometimes. I ran the failing job again on my branch and it now passes. This is probably beyond the scope of this PR and points to an underlying problem. Should we just take that in another issue? If so, do I leave my changes or revert them? |
As mentioned in issue #216 some deprecated code has been removed from asio, making builds fail on boost >= 1.87. This is my attempt to fix this and try to improve the GitHub action to test more versions of Boost on each OS. Changes to the GitHub action were required to make sure that my changes remained backwards compatible.
I'm not an expert on what's going on under the hood in azmq but I just went through every part of the code that wasn't building and looked for the recommended alternative. Any feedback is appreciated.
We rely on azmq for some of our projects, so getting this fixed is of great interest to us.
I've removed the actions running on
macos-11,macos-12andubuntu-20.04since those runners have been deprecated. And I've addedmacos-13,macos-14,macos-15andubuntu-24.04to the matrix, since those are the currently supported versions.Some OS/Boost combinations that weren't being tested before still won't build (mostly macOS), so I would appreciate some help with this. I'm not sure how much of a priority this is for you. They could also be added to the exclusion list in the action.
Closes #216