Skip to content

[BUILD] Link only Boost headers and remove BOOST_USE_STATIC - #10311

Merged
timosachsenberg merged 3 commits into
developfrom
claude/bold-hypatia-befpoq
Sep 28, 2026
Merged

timosachsenberg merged 3 commits into
developfrom
claude/bold-hypatia-befpoq

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #3319. Implements option 1 ("link only the Boost headers") from the status review on the issue.

OpenMS only uses header-only Boost code:

  • Boost.Regex has been header-only since 1.76.
  • Nothing uses Boost.DateTime.
  • FileInfo's Boost.Iostreams filtering_ostream/null_sink are templates.

Linking the compiled regex, iostreams and date_time libraries therefore added only link dependencies. With the old default BOOST_USE_STATIC=ON, they were static archives linked into the shared libOpenMS. That fails where a distribution's archives are not built with -fPIC, and it requires their own dependencies (zstd, lzma, ICU) as development packages.

Build system

  • find_boost() is called without compiled components.
  • libOpenMS, FileMerger and the class tests rely on the public Boost::boost headers target.
  • DecoyDatabase and NucleicAcidSearchEngine (and their tool tests) include no Boost header and now link no Boost target.
  • The Homebrew static-Boost link fixups are removed; they only existed for the compiled components.

BOOST_USE_STATIC removed

  • The option (defined twice) is gone, together with -DBOOST_USE_STATIC in the CMake presets, CI, Dockerfile, gitpod, devcontainer and quickbuild scripts.
  • The status review suggested keeping it as a deprecated no-op. This PR removes it instead: scripts that still pass it (e.g. the bioconda recipe) only get CMake's "Manually-specified variables were not used" warning.
  • Because no compiled component is requested, contrib's static Boost, static vcpkg triplets, Homebrew and distro Boost all configure the same way. Simply flipping the default to OFF would have broken the first two.

Docker image

  • The build stage installs only libboost-dev (the headers) instead of five compiled Boost dev packages.
  • The runtime (library) stage no longer installs the five libboost-*1.83.0 libraries, which libOpenMS no longer loads.

Docs

Not changed

  • The bioconda recipe still passes -DBOOST_USE_STATIC=OFF. It builds the 3.5.0 release, which still needs the flag (conda-forge ships only shared Boost), so the flag can go with the bump to 3.6.0.

Testing

Ubuntu 24.04, GCC 13, Boost 1.83 from apt, Arrow/Parquet 23. Release build with GUI, docs, Thermo RAW and opentims off; none of them use compiled Boost. No Boost flag was passed.

Setup Class tests¹ TOPP tests² TestExternalCodeCore (installed consumer)
Boost dev packages installed 41/41 136/136 11/11
Only libboost1.83-dev (headers) installed, fresh configure 41/41 136/136 11/11

¹ Every class test for a libOpenMS source that uses Boost.Regex, plus the tests the removed Boost link loop covered.
² All tests for FileInfo, FileMerger, DecoyDatabase, NucleicAcidSearchEngine, PercolatorAdapter, OpenNuXL and MSstatsConverter.

  • No built library or tool has a libboost_* NEEDED entry, and libOpenMS.so has no undefined Boost symbols.
  • Before/after: I ran the parent commit's libOpenMS link command (three static Boost archives plus -lbz2 -llzma -lz -lzstd -licu*) against the same objects with -Wl,--trace. It pulled 0 members from the Boost archives and produced a library with a byte-identical .text section and the same exported symbols.
  • Docker package lists, checked in clean ubuntu:24.04 containers:
    • Build stage, with its exact apt list: only libboost-dev/libboost1.83-dev get installed and no libboost_* library is present. OpenMS configures, and OpenMS, OpenMS_CLI, FileInfo and FileMerger build.
    • Runtime (library) stage list plus Arrow/Parquet 23: no Boost package is installed. ldd resolves every dependency of the libraries and tools built above. The FileInfo_1, FileInfo_7 and FileMerger_1 test commands run and write output identical to the passing host runs. The full image build and its test stage were not run.

Not tested locally: Windows, macOS, the vcpkg presets, pyOpenMS and the GUI. CI needs to cover these, especially the Windows static-md triplet.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes (the subset listed under Testing, not the full suite)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

🤖 Generated with Claude Code

https://claude.ai/code/session_01N9CUs8wEoRPn6afieaB7VM


Generated by Claude Code

Summary by CodeRabbit

  • Build
    • OpenMS now uses Boost as a header-only dependency and no longer links compiled Boost libraries. Build and runtime environments no longer need the corresponding Boost library packages.
    • The BOOST_USE_STATIC CMake option has been removed. Passing it may produce an unused-variable warning.
    • Boost configuration no longer includes the previous Homebrew-specific static-library workaround.

OpenMS only uses header-only Boost code: Boost.Regex has been header-only
since 1.76, Boost.DateTime is not used at all, and the Boost.Iostreams
filtering_ostream/null_sink that FileInfo uses are templates. Linking the
compiled regex, iostreams and date_time libraries therefore added nothing
but link dependencies. With the default BOOST_USE_STATIC=ON they were
static archives linked into the shared libOpenMS, which fails where a
distribution's archives are not built with -fPIC, and which needs their
own dependencies (zstd, lzma, ICU) installed as development packages.

- find_boost() is called without compiled components. libOpenMS,
  FileMerger and the class tests rely on the public Boost::boost headers
  target; DecoyDatabase and NucleicAcidSearchEngine (and their tool
  tests) include no Boost header and link no Boost target at all.
- Remove the BOOST_USE_STATIC option, which was also defined twice, and
  the Homebrew static-Boost link fixups that only existed for the
  compiled components.
- Drop -DBOOST_USE_STATIC from the CMake presets, CI, Dockerfile, gitpod,
  devcontainer and quickbuild scripts, and replace the misspelled
  -DBOOST_USE_STATIC_LIBS workaround in AGENTS.md/CLAUDE.md.

Fixes #3319

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N9CUs8wEoRPn6afieaB7VM
OpenMS no longer links any compiled Boost library (previous commit), so
the build stage installs libboost-dev instead of the date_time, iostreams,
regex, math and random dev packages, and the runtime image no longer
installs their libboost-*1.83.0 libraries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N9CUs8wEoRPn6afieaB7VM
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 3afb8dfc-56df-469d-8059-78d6f6a98ef9

📥 Commits

Reviewing files that changed from the base of the PR and between 5fd4850 and 230b639.

📒 Files selected for processing (24)
  • .devcontainer/devcontainer.json
  • .github/actions/build/action.yml
  • .github/workflows/pyopenms-wheels-cibuildwheel.yml
  • .gitpod.yml
  • .vscode-gitpod/settings.json
  • AGENTS.md
  • CHANGELOG
  • CLAUDE.md
  • CMakeLists.txt
  • CMakePresets.json
  • cmake/OpenMSConfig.cmake.in
  • cmake/build_system_macros.cmake
  • cmake/cmake_findExternalLibs.cmake
  • dockerfiles/Dockerfile
  • src/openms/CMakeLists.txt
  • src/tests/class_tests/openms/CMakeLists.txt
  • src/tests/class_tests/openms/executables.cmake
  • src/topp/CMakeLists.txt
  • src/topp/DecoyDatabase/CMakeLists.txt
  • src/topp/DecoyDatabase/test/CMakeLists.txt
  • src/topp/NucleicAcidSearchEngine/CMakeLists.txt
  • src/topp/NucleicAcidSearchEngine/test/CMakeLists.txt
  • tools/quickbuild-osx.sh
  • tools/quickbuild.sh
💤 Files with no reviewable changes (10)
  • CMakeLists.txt
  • .devcontainer/devcontainer.json
  • .vscode-gitpod/settings.json
  • src/tests/class_tests/openms/executables.cmake
  • src/topp/NucleicAcidSearchEngine/test/CMakeLists.txt
  • CLAUDE.md
  • cmake/build_system_macros.cmake
  • .github/workflows/pyopenms-wheels-cibuildwheel.yml
  • src/topp/DecoyDatabase/test/CMakeLists.txt
  • src/topp/CMakeLists.txt

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

OpenMS removes the BOOST_USE_STATIC option and compiled Boost library links. CMake discovery, project targets, Docker dependencies, build configurations, and documentation now reflect use of Boost headers without compiled Boost libraries.

Changes

Boost header-only linkage

Layer / File(s) Summary
Boost discovery and core linkage
CMakeLists.txt, cmake/build_system_macros.cmake, cmake/cmake_findExternalLibs.cmake, src/openms/CMakeLists.txt, cmake/OpenMSConfig.cmake.in
CMake removes the BOOST_USE_STATIC option and compiled component discovery. OpenMS removes compiled Boost targets from its private dependencies and describes Boost as header-only.
Target and image dependencies
src/topp/CMakeLists.txt, src/topp/DecoyDatabase/*, src/topp/NucleicAcidSearchEngine/*, src/tests/class_tests/openms/*, dockerfiles/Dockerfile
Tool and test targets drop Boost.Regex links and component-specific test wiring. The Docker build uses libboost-dev and removes Boost runtime packages.
Build configuration and documentation
CMakePresets.json, .devcontainer/devcontainer.json, .github/actions/build/action.yml, .github/workflows/pyopenms-wheels-cibuildwheel.yml, .gitpod.yml, .vscode-gitpod/settings.json, tools/quickbuild*.sh, AGENTS.md, CHANGELOG, CLAUDE.md
Build presets, CI, development environments, and quick-build scripts stop passing BOOST_USE_STATIC. Guidance and changelog entries describe the header-only setup and removed workaround.

Suggested reviewers: cbielow

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 230b6

The reviewed Boost dependency changes have no identified issue that needs correction before merging. Normal build checks remain appropriate.

Architecture Summary

Architecture risk: 🔵 Low · up to 230b6

The change affects 9 systems.

Changed systems: src, cmake, tools, AGENTS.md, CHANGELOG, CLAUDE.md, CMakeLists.txt, CMakePresets.json, dockerfiles

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 8 changed files map to changed impact.
  • observed — cmake (service) was modified; 3 changed files map to changed impact.
  • observed — tools (service) was modified; 2 changed files map to changed impact.
  • observed — AGENTS.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in AGENTS.md: Removed the macOS Boost static-library workaround, which recommended -DBOOST_USE_STATIC_LIBS=OFF to avoid linker errors from missing transitive dependency declarations.
  • observed — Modified behavior in AGENTS.md: Replaced the Homebrew-specific warning and BOOST_USE_STATIC=OFF/contrib workaround with guidance that OpenMS links Boost headers only and should not link compiled Boost libraries such as Boost::regex or Boost::iostreams.
  • observed — Modified behavior in CHANGELOG: Added a changelog entry stating that OpenMS, its tools and tests no longer link compiled Boost.Regex, Boost.Iostreams or Boost.DateTime libraries; Boost headers suffice, static Boost is supported, and BOOST_USE_STATIC and Homebrew static-Boost link fixups were removed. It also states that passing BOOST_USE_STATIC now triggers a CMake unused-variable warning.
  • observed — Modified behavior in CHANGELOG: Removed the changelog entry describing the Homebrew static-Boost fallback fix, including its handling of dependency flags, missing ICU components and Homebrew prefixes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: removing compiled Boost links and removing the BOOST_USE_STATIC option.
Linked Issues check ✅ Passed Issue [#3319] requires avoiding failures from incompatible static Boost archives or selecting a safe Boost linkage mode. This PR removes compiled Boost components from Boost discovery and from OpenMS …
Out of Scope Changes check ✅ Passed The changed CMake files, build presets, scripts, Docker packages, tests, documentation, and changelog all support the [#3319] fix or its Boost header-only migration. The removed Homebrew fixups suppor…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the Boosted build,
No static flag is being filled.
Header paths now lead the way,
Regex links have hopped away.
The build leaves fewer libs to carry,
And I can nibble carrots, merry.

Comment @coderabbitai help to get the list of available commands.

@jpfeuffer

Copy link
Copy Markdown
Contributor

oh wow, yes sure, if we dont use any compiled boost functionality anymore this is the way to go.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@pjones will you need anything from boost that requires linking?

@timosachsenberg
timosachsenberg merged commit de825ed into develop Sep 28, 2026
12 of 13 checks passed
@timosachsenberg
timosachsenberg deleted the claude/bold-hypatia-befpoq branch September 28, 2026 15:36
@pjones

pjones commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@timosachsenberg As far as the mzPeak library linking with boost, yes:

  • libboost_json
  • libboost_container

But I'm sure this can wait until the integration with OpenMS happens.

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.

Use dynamic contrib libraries as default?

4 participants