Skip to content

fix(build): include <ostream> in io_config.hpp - #7714

Merged
DennisOSRM merged 1 commit into
Project-OSRM:masterfrom
daeho-ro:fix-io-config-ostream-include
Sep 5, 2026
Merged

fix(build): include <ostream> in io_config.hpp#7714
DennisOSRM merged 1 commit into
Project-OSRM:masterfrom
daeho-ro:fix-io-config-ostream-include

Conversation

@daeho-ro

@daeho-ro daeho-ro commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Issue

There is no separate issue: include/storage/io_config.hpp fails to compile against libc++ 23, which no longer provides the transitive includes the header relies on.

IOConfig::ListInputFiles writes into a std::ostream, but the header includes only <array>, <filesystem>, <set>, <string> and <vector>. Up to libc++ 22 one of those pulled in <ostream>; libc++ 23 removed the transitive includes, so the operator<<(std::ostream&, const char*) overload is no longer declared:

include/storage/io_config.hpp:53:21: error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char>') and 'const char[10]')
   53 |                 out << "required " << file.string() << "\n";
      |                 ~~~ ^  ~~~~~~~~~~~

This showed up when building v26.9.0 with Homebrew's clang/libc++ 23 on macOS; the same header in v26.8.0 has the problem too, it just did not surface with libc++ 22.

The fix is to include <ostream> directly.

Tasklist

  • self-review code for correctness and following the coding guidelines
  • add tests (not applicable: missing-include fix, covered by compiling the existing sources)
  • update relevant wiki pages (not applicable)
  • review
  • adjust for comments

Verification

Built v26.9.0 with the patch using clang/libc++ 23 (arm64 macOS): all targets compile and all eight osrm-* binaries link. Without the patch the same build fails with the error above.

AI disclosure

An AI tool (Claude Code) was used to diagnose the failure and prepare this one-line change; the diagnosis and the resulting build were verified locally before submitting.

IOConfig::ListInputFiles writes into a std::ostream, but the header only includes <array>, <filesystem>, <set>, <string> and <vector> and relies on one of them to pull in <ostream> transitively. libc++ 23 removed those transitive includes, so compiling against it fails with: error: invalid operands to binary expression ('std::ostream' and 'const char[10]'). Include <ostream> directly.
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.80%. Comparing base (9e87315) to head (fb0251f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7714      +/-   ##
==========================================
+ Coverage   91.91%   94.80%   +2.89%     
==========================================
  Files         526      526              
  Lines       42085    42085              
==========================================
+ Hits        38682    39899    +1217     
+ Misses       3403     2186    -1217     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DennisOSRM
DennisOSRM merged commit 807122b into Project-OSRM:master Sep 5, 2026
28 of 29 checks passed
@DennisOSRM

Copy link
Copy Markdown
Collaborator

Thanks so much for the contribution

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