Skip to content

setup-deps-standalone: probe compiler for static Boost, not cmake --find-package#389

Merged
afrind merged 1 commit into
mainfrom
fix-boost-static-probe
Jun 6, 2026
Merged

setup-deps-standalone: probe compiler for static Boost, not cmake --find-package#389
afrind merged 1 commit into
mainfrom
fix-boost-static-probe

Conversation

@afrind

@afrind afrind commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

The auto Boost-linking probe from #388 used
cmake --find-package ... -DMODE=EXIST -DBoost_USE_STATIC_LIBS=ON, which is a false positive: that mode only checks whether Boost is locatable at all and ignores Boost_USE_STATIC_LIBS. On distros that ship only libboost_*.so (CentOS/RHEL), it reports "static found", the script selects static linking, and the build dies at ninja time with libboost_context.a ... missing -- the exact failure #388 meant to fix.

Replace the probe with one that asks the compiler driver to resolve each static archive moxygen actually links (context, filesystem, program_options, regex) via c++ -print-file-name. That returns an absolute path only when the .a exists in the compiler's own search paths -- definitive, no hardcoded paths, no distro sniffing.

Also always pass -DBoost_USE_STATIC_LIBS explicitly (ON or OFF) instead of omitting it for shared. A re-run of setup reuses the existing build dir; omitting would leave a stale Boost_USE_STATIC_LIBS=ON in CMakeCache.txt in force.

Verified: clean build picks shared and links; a poisoned =ON cache is overridden to OFF and still builds.


This change is Reviewable

…ind-package

The auto Boost-linking probe from #388 used
`cmake --find-package ... -DMODE=EXIST -DBoost_USE_STATIC_LIBS=ON`,
which is a false positive: that mode only checks whether Boost is
locatable at all and ignores Boost_USE_STATIC_LIBS. On distros that ship
only libboost_*.so (CentOS/RHEL), it reports "static found", the script
selects static linking, and the build dies at ninja time with
`libboost_context.a ... missing` -- the exact failure #388 meant to fix.

Replace the probe with one that asks the compiler driver to resolve each
static archive moxygen actually links (context, filesystem,
program_options, regex) via `c++ -print-file-name`. That returns an
absolute path only when the .a exists in the compiler's own search
paths -- definitive, no hardcoded paths, no distro sniffing.

Also always pass -DBoost_USE_STATIC_LIBS explicitly (ON or OFF) instead
of omitting it for shared. A re-run of `setup` reuses the existing build
dir; omitting would leave a stale Boost_USE_STATIC_LIBS=ON in
CMakeCache.txt in force.

Verified: clean build picks shared and links; a poisoned =ON cache is
overridden to OFF and still builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@gmarzot gmarzot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarzot reviewed 1 file and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on akash-a-n, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).

@afrind afrind merged commit 07d8959 into main Jun 6, 2026
16 checks passed
@afrind afrind deleted the fix-boost-static-probe branch June 6, 2026 16:18
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