Skip to content

Build against current Boost releases - #148

Open
MagnaibayarMN wants to merge 1 commit into
objectcomputing:masterfrom
MagnaibayarMN:boost-compat
Open

Build against current Boost releases#148
MagnaibayarMN wants to merge 1 commit into
objectcomputing:masterfrom
MagnaibayarMN:boost-compat

Conversation

@MagnaibayarMN

Copy link
Copy Markdown

QuickFAST does not compile against any Boost released since 1.66. This fixes that, with every replacement selected on BOOST_VERSION so older Boost releases build exactly as they did before.

The root cause

Communication/AsioService_fwd.h forward declares boost::asio::io_service as a class. Since Boost 1.66 that name is a typedef for io_context, so the declaration conflicts with Asio's own and every use of the type fails. Once that is fixed the rest is a short list:

What changed in Asio Where
I/O objects ask their argument for an executor instead of taking io_service& AsioService now forwards get_executor()
ip::address::from_stringmake_address MulticastReceiver, MulticastSender, PCapToMulticast
io_service::post → free function post AsioService
io_service::resetrestart AsioService
io_service::workexecutor_work_guard AsynchSender
resolver::resolve(query)resolve(host, service) TCPReceiver
asio::strand became a template FileToMulticast, PCapToMulticast
date_time based timers became opt-in the same two examples, now steady_timer
basic_socket is a private base of the socket stream buffer FileToTCP

The repeated version tests live in one new header, Communication/AsioCompatibility.h, rather than at each call site.

Also included: InterpretApplication compared the FILE* from std::fopen with <= 0, which gcc rejects.

Verification

Built and tested against three Boost releases:

Environment Result
Ubuntu 24.04, gcc 13, Boost 1.83, Xerces-C 3.2 library, 6 examples, 112 test cases pass
Ubuntu 25.10, gcc 15, Boost 1.88 library, 6 examples, 112 test cases pass
Boost 1.91 built by vcpkg library, 6 examples, 112 test cases pass

No .mpc, .mpb, .mwc, .features or setup script is touched.

🤖 Generated with Claude Code

https://claude.ai/code/session_017BnyHwonMsq7k6uQxWpVGF

Boost 1.66 reorganized Asio and Boost 1.87 removed what it had deprecated,
so QuickFAST has not compiled against a current Boost for some years.  These
are the changes needed to build with Boost 1.66 through at least 1.91, with
every replacement selected on BOOST_VERSION so that older Boost releases
build exactly as they did before.

The library:

* AsioService_fwd.h forward declared boost::asio::io_service as a class.
  From Boost 1.66 on it is a typedef for io_context, so that declaration
  conflicts with Asio's own and every use of the type fails.  The name is
  now taken from Asio itself; Boost 1.87 and later, which dropped the name
  entirely, get a typedef for io_context.

* The Asio I/O objects replaced their io_service& constructors with a
  template that asks its argument for an executor, so the implicit cast on
  AsioService is no longer enough to construct a socket or a resolver from
  one.  AsioService now forwards get_executor() to the io_service it wraps.

* A new header, Communication/AsioCompatibility.h, spells the four remaining
  interfaces the way the Boost release being compiled against expects:
  ip::address::from_string is now make_address, io_service::post is now the
  free function post, io_service::reset is now restart, and io_service::work
  is now executor_work_guard.  The call sites ask it rather than repeating a
  version test each time.

* The iterator-returning resolver::resolve(query) in TCPReceiver became
  resolve(host, service) returning a results range.

The examples:

* boost::asio::strand became a template, so the two burst senders name the
  class they want, io_service::strand, and reach it through dispatch and
  bind_executor rather than the strand's own wrap and dispatch.

* Asio's date_time based timers are opt-in in recent releases, so those two
  examples use steady_timer and a chrono duration instead of
  deadline_timer and a posix_time duration.

* basic_socket became a private base of the socket stream buffer, so
  FileToTCP moves an accepted socket into its stream instead of accepting
  into the stream's buffer.

* Compare the FILE* returned by std::fopen against 0 rather than ordering it
  against 0, which gcc rejects.

Verified on Ubuntu 24.04 (gcc 13, Boost 1.83), Ubuntu 25.10 (gcc 15, Boost
1.88) and against Boost 1.91 built by vcpkg: the library, all six example
programs and all 112 unit test cases build and pass in each.  No MPC file,
setup script or build flag is changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BnyHwonMsq7k6uQxWpVGF
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.

2 participants