Fix build with modern Boost.Asio (io_service / resolver::query removed in 1.87) - #46
Open
idesign0 wants to merge 1 commit into
Open
Fix build with modern Boost.Asio (io_service / resolver::query removed in 1.87)#46idesign0 wants to merge 1 commit into
idesign0 wants to merge 1 commit into
Conversation
Author
|
@traversaro 👋 in case it's useful |
…r query/iterator removed) - boost::asio::io_service -> io_context (io_service was a deprecated alias for io_context since 1.66 and was removed in Boost 1.87). - io_context::reset() -> restart(). - resolver::query / resolver::iterator -> the resolve(protocol, host, service) overload returning a results range; *iterator still yields an endpoint via the resolver entry conversion, so socket_.connect(*it) is unchanged. All APIs used are available since Boost 1.66 (which ROS 2 already requires). Compiles against Boost 1.90 (Apple clang, C++17). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: idesign0 <dhruvpatel2991998@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
network_interfacefails to build against modern Boost.Asio:boost::asio::io_servicewas a deprecated alias forio_context(since 1.66) and was removed in Boost 1.87 →no type named 'io_service' in namespace 'boost::asio'.boost::asio::ip::*::resolver::queryandresolver::iteratorwere likewise removed.Fix
boost::asio::io_service→boost::asio::io_context(theio_service_members).io_service_.reset()→io_service_.restart().resolver::query+resolver::iterator→ theresolve(protocol, host, service)overload returning a results range.*iteratorstill yields an endpoint through the resolver-entry conversion, sosocket_.connect(*it, ec)andendpoint_ = *endpoints.begin()are unchanged in behaviour.All APIs used have existed since Boost 1.66 (which ROS 2 already requires), so there's no new minimum-Boost requirement. Compiles against Boost 1.90 (Apple clang, C++17).
Tested on
macos-26runnersclang-2100.1.1.101, targetarm64-apple-darwin25.5.0), C++17, libc++