Skip to content

Fix build with modern Boost.Asio (io_service / resolver::query removed in 1.87) - #46

Open
idesign0 wants to merge 1 commit into
astuff:ros2_masterfrom
idesign0:ros2_master
Open

Fix build with modern Boost.Asio (io_service / resolver::query removed in 1.87)#46
idesign0 wants to merge 1 commit into
astuff:ros2_masterfrom
idesign0:ros2_master

Conversation

@idesign0

@idesign0 idesign0 commented Aug 12, 2026

Copy link
Copy Markdown

What

network_interface fails to build against modern Boost.Asio:

  • boost::asio::io_service was a deprecated alias for io_context (since 1.66) and was removed in Boost 1.87no type named 'io_service' in namespace 'boost::asio'.
  • boost::asio::ip::*::resolver::query and resolver::iterator were likewise removed.

Fix

  • boost::asio::io_serviceboost::asio::io_context (the io_service_ members).
  • io_service_.reset()io_service_.restart().
  • resolver::query + resolver::iterator → the resolve(protocol, host, service) overload returning a results range. *iterator still yields an endpoint through the resolver-entry conversion, so socket_.connect(*it, ec) and endpoint_ = *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 26 (Apple Silicon / arm64) — GitHub Actions macos-26 runners
  • Apple clang 21.0.0 (clang-2100.1.1.101, target arm64-apple-darwin25.5.0), C++17, libc++
  • fmt 12.2.0 (Homebrew)
  • Built from source in a ROS 2 (Humble / Jazzy / Kilted) workspace, CMake 4.3
  • Linux behaviour unchanged (modern Boost.Asio equivalents).

@idesign0

Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant