Skip to content

fix(asio): keep std::println usable with import asio - #175

Open
wellwei wants to merge 1 commit into
mcpplibs:mainfrom
wellwei:codex/fix-asio-println
Open

fix(asio): keep std::println usable with import asio#175
wellwei wants to merge 1 commit into
mcpplibs:mainfrom
wellwei:codex/fix-asio-println

Conversation

@wellwei

@wellwei wellwei commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Repair the Form B chriskohlhoff.asio@1.38.1 module recipe by propagating Asio's supported ASIO_NO_IOSTREAM define through the default separate-compilation feature.
  • Keep libc++ <print> out of the asio BMI so std::println remains usable after import std; import fmt; import asio;.
  • Extend the active asio-module consumer test with the reported import combination and both zero-argument and formatted std::println calls.

Root cause

The Asio module wrapper includes the TCP surface. Without ASIO_NO_IOSTREAM, that path also exposes Asio's iostream adapters and pulls libc++ <print> into the asio BMI. With the same standard-library declarations already provided by the std BMI, Clang 22.1.8 can bind std::println incorrectly and reports failures such as:

no member named 'parse' in 'std::__1::formatter<std::__1::basic_format_string<char>>'

Defining ASIO_NO_IOSTREAM at the existing separate-compilation feature boundary keeps the BMI, Asio implementation sources, and consumer TUs on one consistent macro contract.

Compatibility

This disables Asio's iostream/streambuf adapter surface, including basic_socket_iostream (asio::ip::tcp::iostream) and streambuf-based read_at/write_at overloads. Core socket, timer, coroutine, and asynchronous APIs remain available and continue to be exercised by the existing consumer tests.

This is a recipe repair only:

  • upstream source URLs and SHA-256 values are unchanged;
  • Linux, macOS, and Windows declarations are unchanged;
  • index.toml's min_mcpp and the workflow mcpp pin are unchanged;
  • no mirror or release asset changes are required.

Verification

Reproduced before the repair on macOS with mcpp 2026.8.6.2, LLVM 22.1.8, and import std; import fmt; import asio;: the consumer failed in libc++ format_functions.h with the formatter diagnostics above.

After the repair:

  • mcpp test --cache=local from tests/examples/asio-module: 5 passed, 0 failed; the surface binary printed both expected std::println lines.
  • MCPP_TIMINGS=/tmp/mcpp-index-asio-pr-timings.tsv bash tests/run_members.sh asio-module: 5 passed, 0 failed.
  • Lua syntax, mirror URL, and package-name checks passed locally with Lua 5.5.0.
  • mcpp xpkg parse pkgs/c/chriskohlhoff.asio.lua passed with mcpp 2026.8.6.2.
  • git diff --check upstream/main..HEAD passed.

Local behavioral coverage is macOS ARM64 only. The PR's required GitHub Actions matrix must provide Linux, macOS, and Windows evidence before merge.

@wellwei

wellwei commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

CI follow-up

The platform matrix exercised both affected members selected by the workflow (asio-module and asio-ssl):

  • macOS: both members passed; asio-module printed both regression lines and reported 5/5 tests passed.
  • Windows: both members passed; asio-module printed both regression lines and reported 5/5 tests passed.
  • Linux: asio-module passed with 5/5 tests and both regression lines. The same job then failed while building the unrelated compat.openssl@3.5.1 dependency for asio-ssl; GCC reported missing stdlib.h, limits.h, and assert.h.

This OpenSSL failure is reproducible on the current base branch: the recent main validation run 31102350743 has the same missing-system-header failure in two Linux workspace shards. I attempted to rerun the failed job, but the upstream repository requires admin rights for reruns; the fork account does not have that permission.

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