Skip to content

[BUILD] Fix the ICU and compression link-interface rewrites for static brew Boost - #10187

Merged
timosachsenberg merged 7 commits into
developfrom
claude/vigilant-meitner-cnyg0b
Sep 18, 2026
Merged

timosachsenberg merged 7 commits into
developfrom
claude/vigilant-meitner-cnyg0b

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes to the brew-Boost fallback in cmake/cmake_findExternalLibs.cmake, which rewrites Boost::iostreams' and Boost::regex's link interfaces from boost's raw -l… flags to imported targets, because boost's CMake config does not expose those transitive dependencies as targets (boost_install#64).

1. ICU:uc → ICU::uc (fb0fb78). The middle entry had a single colon. CMake only treats a name as a target when it contains ::, so it was passed through as a plain library name and lands on the link line verbatim: /usr/bin/ld: cannot find -lICU:uc.

2. Both blocks: substitute only what boost listed, and only what was found (909f8fc, 074e3ee, 5e5e3e3). In each block the find_package calls were conditional on what boost's interface mentioned, but the set_target_properties that depends on them was not:

  • Boost::regex named ICU::data;ICU::uc;ICU::i18n for every static brew Boost. This is the only find_package(ICU) in the project, so a boost whose regex was not built against ICU — or any build where ICU is missing — stopped the configure with The link interface of target "Boost::regex" contains: ICU::data but the target was not found.
  • Boost::iostreams named BZip2::BZip2;ZLIB::ZLIB;zstd::libzstd_shared;LibLZMA::LibLZMA unconditionally. ZLIB::ZLIB and BZip2::BZip2 survive only because they are found unconditionally further down the file; an interface listing zstd without lzma names LibLZMA::LibLZMA with no find_package behind it, and zstd::libzstd_shared does not exist when zstd was built static — the same error either way.

Both blocks now translate entry by entry through one helper: detect what boost actually listed, look for exactly that, and substitute each entry only if a target for it exists — otherwise boost's own flag stays and a warning names that one dependency. zstd falls back to zstd::libzstd_static, as the opentims block already does. Neither block discards the rest of the interface any more.

3. OPTIONAL_COMPONENTS for ICU (dbfda9e). The per-component step above did not work as 074e3ee claimed, and a review pass caught it: find_package(ICU COMPONENTS ...) marks every listed component required even without REQUIRED, and FindICU creates all its imported targets inside if(ICU_FOUND). One missing component therefore left no ICU:: target at all, so the very case the change existed for substituted nothing. Verified against the real module with a root holding libicudata+libicuuc but not libicui18n:

COMPONENTS           -> ICU_FOUND=FALSE, ICU::data, ICU::uc, ICU::i18n  ALL missing
OPTIONAL_COMPONENTS  -> ICU_FOUND=TRUE,  ICU::data and ICU::uc present, ICU::i18n missing

The same commit carries four smaller review findings: ICU entries are matched with the macro's anchored pattern instead of a bare substring (so a debug -licuucd is no longer swapped for the release ICU::uc) and reuse the macro rather than repeating its logic; find_package inside the macro is QUIET, so a config-mode miss no longer prints CMake's generic "set zstd_DIR" warning right before ours; the ICU-missing case names -DICU_ROOT="$(brew --prefix icu4c)" instead of brew install icu4c, which cannot help because icu4c is keg-only; and the macro's remedy no longer suggests -DBOOST_USE_STATIC=OFF for zlib/bzip2, which are found REQUIRED later regardless of boost's linkage.

4. Apple Silicon (6511e14). Both blocks were gated on the boost library living under /usr/local/, Homebrew's prefix on Intel only. On Apple Silicon brew installs to /opt/homebrew, so with a static brew boost neither block ran — no rewrite, not even the "not fully supported" warning — and the raw flags reached a linker that does not search /opt/homebrew/lib. The gate now matches any Homebrew prefix (/opt/homebrew, /usr/local, $HOMEBREW_PREFIX) using cmake_path(IS_PREFIX), which compares whole path components, so /usr/locale is not inside /usr/local.

The flag-to-target helper is a macro, not a function, so the imported targets its find_package creates stay visible to the caller. That makes the regex worth a note in the code: a macro substitutes arguments as text, so a backslash escape passed in is unescaped twice — "\\." arriving as "." made the zlib stem match -lzstd and silently swallow it. The macro takes the library stem and builds the regex itself.

Verification. None of this is reachable by CI: the gate needs a static brew Boost, and CI builds with vcpkg. Each piece was verified by extracting it verbatim into a scratch project — the ICU block against the real FindICU with fake ICU roots (the stub I used earlier is what hid finding 3), the iostreams block against stub find modules that can withhold packages, the gate against a fake imported target.

Boost::regex, real FindICU:

interface before ICU root result
-licui18n;-licuuc;-licudata;-lpthread all three -lpthread;ICU::data;ICU::i18n;ICU::uc
-licui18n;-licuuc;-licudata;-lpthread i18n absent -licui18n;-lpthread;ICU::data;ICU::uc + one warning naming icui18n
-licuuc;-licudata;-lpthread all three -lpthread;ICU::data;ICU::uc
-lpthread;-lm all three untouched, find_package not called
-licuuc;-licudata ICU absent flags kept, one warning naming ICU_ROOT

Boost::iostreams:

interface before available result
-lz;-lbz2;-lzstd;-llzma all ZLIB::ZLIB;BZip2::BZip2;zstd::libzstd_shared;LibLZMA::LibLZMA
-lz;-lzstd zstd static only ZLIB::ZLIB;zstd::libzstd_static
-lz;-lbz2 all ZLIB::ZLIB;BZip2::BZip2 — no invented zstd/lzma
-lz;-lzstd zstd absent -lzstd;ZLIB::ZLIB + exactly one warning
/usr/local/lib/libz.dylib;/usr/local/lib/libzstd.dylib;-lpthread all -lpthread;ZLIB::ZLIB;zstd::libzstd_shared
-lpthread all untouched

The gate:

IMPORTED_LOCATION result
/opt/homebrew/lib/libboost_regex.a enters (skipped before 6511e14)
/usr/local/lib/libboost_regex.a enters
/usr/locale/lib/libboost_regex.a skips
<build>/vcpkg_installed/x64-linux/lib/libboost_regex.a skips — the row CI takes, so CI is unaffected
/opt/custombrew/... with / without HOMEBREW_PREFIX enters / skips

All configure cleanly, and the complete file still parses (cmake -P reaches execution and stops only at the missing XercesC).

Noticed while checking whether #5436 (libicu RPATH) still applies — unrelated to that issue, which is now closed as obsolete.

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
  • 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_0172Te4jm5uUVnb42TADzMe2

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with statically linked Boost configurations using Homebrew on Intel and Apple Silicon Macs.
    • ICU dependencies are now resolved component by component, supporting a broader range of ICU components.
    • Missing ICU targets no longer prevent build configuration; a warning is shown and the original library reference is retained.
    • Improved library detection to avoid incorrect matches when Homebrew is installed in relocated or custom paths.

cmake_findExternalLibs.cmake rewrites Boost::regex's link interface to
the imported ICU targets when Boost is a static build from brew, but the
middle entry was spelled "ICU:uc" with a single colon.

CMake only treats a name as a target when it contains "::", so "ICU:uc"
is passed through as a plain library name and lands on the link line as
-lICU:uc, which fails with "cannot find -lICU:uc". The two neighbouring
entries and FindICU itself use ICU::<component>, lower case.

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

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 81fc558b-4633-42d6-ab26-b40cff4840a9

📥 Commits

Reviewing files that changed from the base of the PR and between dbfda9e and 6511e14.

📒 Files selected for processing (1)
  • cmake/cmake_findExternalLibs.cmake

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The CMake configuration detects multiple Homebrew prefixes and adds reusable mapping for selected Boost linker flags. Static Boost iostreams and regex fixups resolve available compression and ICU targets while preserving unresolved flags with warnings.

Changes

Boost link flag target mapping

Layer / File(s) Summary
Homebrew-aware linker flag mapping
cmake/cmake_findExternalLibs.cmake
The configuration detects /opt/homebrew, /usr/local, and HOMEBREW_PREFIX with component-aware checks. A reusable macro maps matching flags to available imported targets and warns when flags remain unresolved.
Dependency-specific link rewrites
cmake/cmake_findExternalLibs.cmake
Boost iostreams maps available compression targets and prefers shared over static zstd targets. Boost regex discovers and maps listed ICU components individually.

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6511e

The Homebrew-specific rewrite is conditionally applied and preserves unsupported linker flags; no actionable merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing ICU and compression link-interface rewrites for static Homebrew Boost. It is specific and concise.
✨ Finishing Touches
🧪 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 each Homebrew trail
Boost flags follow the proper rail
Zstd and ICU targets align
Unresolved flags remain in line
Warnings mark what cannot bind
Clean CMake paths are easier to find

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

…ound

The overwrite was unguarded: find_package(ICU) ran only when an icui18n
entry was present in Boost::regex's link interface, but the
set_target_properties call that depends on it ran for every static brew
Boost under /usr/local/. This is the only find_package(ICU) in the
project, so a Boost whose regex was not built against ICU -- or any
build where ICU is not found -- names three imported targets that exist
nowhere and CMake stops at generate time:

  The link interface of target "Boost::regex" contains:
      ICU::data
    but the target was not found.

Guard the rewrite on the targets actually existing, and replace only the
ICU entries instead of discarding the whole interface. When ICU is
missing, leave boost's plain -licu* flags in place and warn: a later
linker error naming icu beats a configure error about a missing imported
target. Same shape the opentims block further down already uses.

Verified with the block extracted verbatim into a scratch project:
no ICU in the interface -> untouched; ICU present but not findable ->
untouched plus warning; ICU found -> the three targets substituted with
the non-ICU entries preserved. All three configure cleanly; the first
two were hard errors before.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0172Te4jm5uUVnb42TADzMe2
@timosachsenberg timosachsenberg changed the title [BUILD] Fix ICU::uc target name typo in the brew Boost::regex fallback [BUILD] Fix the ICU link interface rewrite for static brew Boost::regex Sep 18, 2026
Comment thread cmake/cmake_findExternalLibs.cmake Outdated
# imported target that no find_package created is a hard error at generate
# time ("the link interface contains ICU::data but the target was not
# found"), and this is the only find_package(ICU) in the project.
if (libs MATCHES "icui18n")

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.

in theory this is still not correct. You are assuming if i18n is found that all the others are needed, which is not necessarily true.
If you fix this, fix it completely

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right — keying off icui18n and then demanding all three was still an assumption about how boost was built. Fixed in 074e3ee: each FindICU component is detected in the existing link interface, only those are requested, and each is substituted only if its imported target exists; otherwise boost's plain flag for that one component stays and the warning names that component alone.

Verified by extracting the block verbatim into a scratch project with a fake Boost::regex and a stub FindICU that can withhold components:

interface before requested result
-lpthread;-lm (find_package not called) untouched
-licuuc;-licudata;-lpthread data;uc -lpthread;ICU::data;ICU::uc — no invented ICU::i18n
-licui18n;-licuuc;-licudata, i18n unavailable data;i18n;uc -licui18n;ICU::data;ICU::uc + one warning naming i18n
-licui18n;-licuuc;-licudata;-lpthread, all available data;i18n;uc -lpthread;ICU::data;ICU::i18n;ICU::uc
brew absolute paths (/usr/local/opt/icu4c/lib/libicuuc.dylib, …) i18n;uc ICU::i18n;ICU::uc

One thing I'd like your call on before calling it complete: the Boost::iostreams block directly above (lines 42–56) has the same defect — zstd/LibLZMA are found conditionally, but "BZip2::BZip2;ZLIB::ZLIB;zstd::libzstd_shared;LibLZMA::LibLZMA" is set unconditionally. ZLIB::ZLIB and BZip2::BZip2 survive because they're found unconditionally later in the file (lines 174, 190), but an iostreams interface listing zstd without lzma hits the same generate-time error, and zstd::libzstd_shared doesn't exist when zstd resolves only as zstd::libzstd_static. I can apply the same per-entry treatment here (falling back to zstd::libzstd_static, then to leaving the flag, as the opentims block at line 658 already does) — want that in this PR, or separately?


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Went ahead with the Boost::iostreams block too, in 5e5e3e3 — sorry for the extra push after your approval; it was the same defect and leaving half of it fixed didn't seem right given "fix it completely".

Both blocks now swap only what boost actually listed, for the first candidate target that exists, and leave boost's flag in place with a warning otherwise. zstd falls back to zstd::libzstd_static when the shared target is absent, as the opentims block at line 658 does. Boost::regex is unchanged from what you approved.

The shared helper is a macro, not a function, so the imported targets its find_package creates stay visible to the caller. That bit me while writing it and is worth flagging, since it's a trap for the next person: a macro substitutes arguments as text, so a regex passed in as an argument gets unescaped twice — "\\." arrived as ".", which made the zlib pattern ^(-l|.*lib)z(.|$) match -lzstd and silently swallow it. The macro now takes the library stem and builds the regex itself; there's a comment saying why.

Verified the same way, with the macro and its four call sites extracted verbatim against a fake Boost::iostreams and stub find modules:

interface before available result
-lz;-lbz2;-lzstd;-llzma all ZLIB::ZLIB;BZip2::BZip2;zstd::libzstd_shared;LibLZMA::LibLZMA
-lz;-lzstd zstd static only ZLIB::ZLIB;zstd::libzstd_static
-lz;-lbz2 all ZLIB::ZLIB;BZip2::BZip2 — no invented zstd/lzma (the old code named both)
-lz;-lzstd zstd absent -lzstd;ZLIB::ZLIB + one warning naming zstd
/usr/local/lib/libz.dylib;/usr/local/lib/libzstd.dylib;-lpthread all -lpthread;ZLIB::ZLIB;zstd::libzstd_shared
-lpthread all untouched

I've re-requested your review since the push may have dismissed the approval.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correction to what I told you above, please don't merge on the strength of that table: the per-component behaviour I claimed for 074e3ee did not actually happen, and a review pass caught it. Fixed in dbfda9e.

find_package(ICU COMPONENTS ...) marks every listed component required even without REQUIRED, and FindICU creates all its imported targets inside if(ICU_FOUND). So one missing component meant no ICU:: target at all — the exact case the change existed for (boost listing i18n/uc/data with only two installed) substituted nothing, warned three times and left every raw flag in place. My verification missed it because the stub FindICU I tested against created each component independently, which the real module does not. Reproduced against /usr/share/cmake-3.28/Modules/FindICU.cmake with a root holding libicudata+libicuuc but not libicui18n:

COMPONENTS           -> ICU_FOUND=FALSE, ICU::data, ICU::uc, ICU::i18n  ALL missing
OPTIONAL_COMPONENTS  -> ICU_FOUND=TRUE,  ICU::data and ICU::uc present, ICU::i18n missing

Re-verified the block itself against the real module, no stub:

interface before ICU root result
-licui18n;-licuuc;-licudata;-lpthread all three -lpthread;ICU::data;ICU::i18n;ICU::uc
-licui18n;-licuuc;-licudata;-lpthread i18n absent -licui18n;-lpthread;ICU::data;ICU::uc + one warning naming icui18n
-licuuc;-licudata;-lpthread all three -lpthread;ICU::data;ICU::uc
-lpthread;-lm all three untouched, find_package not called
-licuuc;-licudata ICU absent flags kept, one warning

Four smaller findings from the same pass, all in this branch's code, also in dbfda9e:

  • ICU entries were matched by bare substring while the iostreams macro anchors its pattern, so -licuucd (a debug ICU) would have been detected as component uc and swapped for the release ICU::uc. Both paths use the anchored form now, and the ICU loop reuses the macro instead of repeating its logic.
  • find_package inside the macro is now QUIET — a config-mode miss printed CMake's generic "set zstd_DIR" warning right before ours, with different advice. (The opentims block already passes QUIET.)
  • brew install icu4c was useless advice: icu4c is keg-only, so installing it changes nothing. That case now names -DICU_ROOT="$(brew --prefix icu4c)".
  • The macro's -DBOOST_USE_STATIC=OFF hint is wrong for the zlib and bzip2 call sites, since ZLIB and BZip2 are found REQUIRED later in this file regardless of boost's linkage. The remedy is stated in terms of CMAKE_PREFIX_PATH / _ROOT now.

One thing I have not touched, since it is pre-existing and changes which builds enter this code: the whole fallback is gated on location MATCHES "^/usr/local/", which never matches Apple Silicon Homebrew under /opt/homebrew. On arm64 macs with a static brew boost, neither block runs and even the "not fully supported" warning is skipped, so the raw -lzstd/-licuuc entries reach the linker, which does not search /opt/homebrew/lib. Want that guard widened here, or separately?


Generated by Claude Code

The previous guard still assumed the whole set: it triggered on an
icui18n entry and then required and substituted data, uc and i18n
together. Which ICU libraries boost::regex links depends on how boost
was built, so that both requests components boost may not use and, when
one of them is missing, drops the rewrite for the ones that are present.

Detect each FindICU component in the existing link interface, request
exactly those, and substitute each one only if its imported target
exists -- otherwise leave boost's plain link flag for that component in
place and warn about that component alone.

Verified with the block extracted verbatim into a scratch project,
driving a fake Boost::regex through a stub FindICU:
  no icu entries          -> find_package not called, interface untouched
  -licuuc -licudata       -> requests "data;uc", yields ICU::data;ICU::uc
                             and no invented ICU::i18n
  all three, i18n missing -> ICU::data;ICU::uc substituted, -licui18n
                             kept, one warning naming i18n
  all three available     -> all three targets, non-ICU entries preserved
  brew absolute paths     -> matched and substituted

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0172Te4jm5uUVnb42TADzMe2
The iostreams block had the defect the regex block just lost: zstd and
LibLZMA were looked for only when boost's link interface mentioned them,
but the interface was then overwritten with

  "BZip2::BZip2;ZLIB::ZLIB;zstd::libzstd_shared;LibLZMA::LibLZMA"

unconditionally. ZLIB::ZLIB and BZip2::BZip2 survive that because they
are found unconditionally further down this file, but an interface
listing zstd without lzma names LibLZMA::LibLZMA with no find_package
behind it, and zstd's config package exports zstd::libzstd_shared only
when zstd was built shared -- either way a generate-time error. It also
discarded every entry boost listed that is not one of those four.

Swap each backend boost actually listed for the first candidate target
that exists, taking zstd::libzstd_static when the shared one is absent
as the opentims block further down already does, and leave boost's plain
flag in place with a warning when nothing matches.

The shared helper is a macro rather than a function so that the imported
targets its find_package creates stay visible to the caller. That makes
the regex worth a note: a macro substitutes arguments as text, so a
backslash escape passed in is unescaped twice -- "\\." arriving as "."
made the zlib stem match -lzstd and silently swallow it. The macro now
takes the library stem and builds the regex itself.

Verified with the macro and its four call sites extracted verbatim into
a scratch project, against a fake Boost::iostreams and stub find modules
that can withhold packages:
  -lz -lbz2 -lzstd -llzma, all found -> all four targets, shared zstd
  zstd only static                   -> zstd::libzstd_static
  only -lz -lbz2 listed              -> those two, no invented zstd/lzma
  -lzstd listed, zstd not findable   -> -lzstd kept, one warning
  brew paths + -lpthread             -> paths swapped, -lpthread kept
  nothing listed                     -> interface untouched
The Boost::regex block is unchanged and still behaves as reviewed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0172Te4jm5uUVnb42TADzMe2
@timosachsenberg timosachsenberg changed the title [BUILD] Fix the ICU link interface rewrite for static brew Boost::regex [BUILD] Fix the ICU and compression link-interface rewrites for static brew Boost Sep 18, 2026
…titutes

The per-component translation added in 074e3ee did not do what its commit
message claimed. find_package(ICU COMPONENTS ...) marks every listed
component required even without REQUIRED, and FindICU creates all its
imported targets inside "if(ICU_FOUND)", so one missing component left
no ICU:: target at all. The case the change existed for -- boost listing
icui18n, icuuc and icudata where only two are installed -- therefore
substituted nothing, warned three times and left every raw flag in
place. It passed review because the test stubbed FindICU, and the stub
created each component independently; against the real module it fails.

Reproduced with /usr/share/cmake-3.28/Modules/FindICU.cmake and an ICU
root holding libicudata and libicuuc but not libicui18n:
  COMPONENTS          -> ICU_FOUND=FALSE, all three targets missing
  OPTIONAL_COMPONENTS -> ICU_FOUND=TRUE, ICU::data and ICU::uc present
Re-verified the block itself the same way, no stub in sight:
  all three listed and present  -> all three substituted
  i18n missing                  -> ICU::data;ICU::uc, -licui18n kept,
                                   one warning naming icui18n
  only uc+data listed           -> only those two requested
  no icu entries                -> untouched, find_package not called
  ICU absent entirely           -> flags kept, one warning

Four smaller review findings, all in this branch's own code:

- The ICU entries were matched by bare substring while the iostreams
  macro anchors its pattern, so "-licuucd" would have been detected as
  component uc and swapped for the release ICU::uc. Both now use the
  anchored form, and the ICU loop reuses the macro for the substitution
  instead of repeating it.
- find_package inside the macro is QUIET: a config-mode miss printed
  CMake's generic "set zstd_DIR" warning immediately before our own,
  with different advice. The opentims block already passes QUIET.
- "install ICU (e.g. 'brew install icu4c')" cannot fix an ICU miss --
  icu4c is keg-only, so installing it changes nothing. That case now
  names -DICU_ROOT="$(brew --prefix icu4c)".
- The macro's "or use -DBOOST_USE_STATIC=OFF" hint is wrong for the zlib
  and bzip2 call sites, where ZLIB and BZip2 are found REQUIRED later in
  this file regardless of the boost linkage. The remedy is now stated in
  terms of CMAKE_PREFIX_PATH and _ROOT variables.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0172Te4jm5uUVnb42TADzMe2
@jpfeuffer

Copy link
Copy Markdown
Contributor

yesh should be fine. remember that since we use vcpkg, CI is not testing the changes.

Copy link
Copy Markdown
Contributor Author

Agreed, and that cuts both ways here: CI can't reach this code at all — vcpkg aside, the branch needs a static brew Boost under /usr/local/ — so green CI says nothing about these changes. That's why each block was verified by extracting it verbatim into a scratch project and driving a fake Boost::regex/Boost::iostreams through it: the real FindICU with fake ICU roots for the ICU path (a stub is precisely what hid the COMPONENTS bug), stub find modules for zlib/bz2/zstd/lzma. The tables in the description are those runs, not CI.

One thing so it doesn't get lost: was "should be fine" also a yes to widening the ^/usr/local/ guard to cover Apple Silicon Homebrew (/opt/homebrew), where neither block runs today? Happy either way — I can add it here, or leave this PR as is and open a separate one.


Generated by Claude Code

@jpfeuffer

Copy link
Copy Markdown
Contributor

yes, add it obviously. we dont even support intel anymore officially.

…sr/local

Both blocks were gated on the boost library's location matching
"^/usr/local/", Homebrew's prefix on Intel only. On Apple Silicon brew
installs to /opt/homebrew, so with a static brew boost neither block ran
-- no link-interface rewrite and not even the "not fully supported"
warning -- and boost's plain -lzstd/-licuuc entries reached a linker
that does not search /opt/homebrew/lib. Intel is no longer officially
supported, so this covered the platform we do not ship and skipped the
one we do.

Match any Homebrew prefix instead: /opt/homebrew, /usr/local, and
$HOMEBREW_PREFIX when the environment sets it for a relocated install.
The comparison is cmake_path(IS_PREFIX), which works on whole path
components -- /usr/locale is not inside /usr/local -- rather than a
string regex.

Verified against a fake imported Boost::regex:
  /opt/homebrew/lib/libboost_regex.a                  -> enters (was skipped)
  /usr/local/lib/libboost_regex.a                     -> enters
  /usr/locale/lib/libboost_regex.a                    -> skips
  <build>/vcpkg_installed/x64-linux/lib/libboost_regex.a -> skips
  /opt/custombrew/... without HOMEBREW_PREFIX         -> skips
  /opt/custombrew/... with HOMEBREW_PREFIX set        -> enters
The vcpkg case is the one CI takes, so CI behaviour is unchanged. The
two blocks themselves are untouched and re-checked against the real
FindICU after the move.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0172Te4jm5uUVnb42TADzMe2

Copy link
Copy Markdown
Contributor Author

Added in 6511e14. Both blocks now match any Homebrew prefix — /opt/homebrew, /usr/local, and $HOMEBREW_PREFIX when the environment sets it for a relocated install — via cmake_path(IS_PREFIX), which compares whole path components rather than a string prefix (so /usr/locale is not inside /usr/local).

Verified against a fake imported Boost::regex:

IMPORTED_LOCATION gate
/opt/homebrew/lib/libboost_regex.a enters (skipped before this commit)
/usr/local/lib/libboost_regex.a enters
/usr/locale/lib/libboost_regex.a skips
<build>/vcpkg_installed/x64-linux/lib/libboost_regex.a skips
/opt/custombrew/... without HOMEBREW_PREFIX skips
/opt/custombrew/... with HOMEBREW_PREFIX set enters

The vcpkg row is the one CI takes, so CI behaviour is unchanged — which, per your point, is also why CI passing says nothing about the rest of this. The two blocks themselves are untouched, and I re-ran the ICU one against the real FindICU after the move.

Re-requested your review, since the push will have dismissed the approval again.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI is red on 6511e14, and it is not this PR's doing — it is develop, so every open PR will hit it. Flagging rather than fixing it here.

Failing: TestExternalCodeRelocated_configure (and its dependants _build/_run, Not Run) on all three Linux build-and-test jobs — (ubuntu-24.04, g++), (ubuntu-24.04, clang++), (ubuntu-24.04-arm, g++). Same failure in each:

CMake Error at CMakeLists.txt:55 (message):
  an include directory of
  OpenMS::OpenMS='$<BUILD_INTERFACE:/…/installed-consumer/relocated prefix/include>'
  is not below the prefix the installation was moved to
  ('/…/installed-consumer/relocated prefix')

The installed export's INTERFACE_INCLUDE_DIRECTORIES for OpenMS::OpenMS carries a literal, unevaluated $<BUILD_INTERFACE:…> entry. The new relocation test reads that property with get_target_property and asserts every entry is a directory below the new prefix, so the genex string fails both checks.

Why it isn't this PR:

  • TestExternalCodeRelocated does not exist on this branch. It arrived in develop as d54e458 (Add relocation test for OpenMS package configuration #10186) at 13:50 UTC, and PR CI builds the merge commit — this is the first run of mine to include it.
  • This PR's diff is one file, cmake/cmake_findExternalLibs.cmake, entirely inside the Homebrew-gated Boost::iostreams/Boost::regex blocks. In a vcpkg CI build the gate does not even enter (verified: <build>/vcpkg_installed/… matches no Homebrew prefix), and nothing in it touches install, export or include directories.
  • The previous head dbfda9e ran at 13:35 UTC — before Add relocation test for OpenMS package configuration #10186 merged — and showed none of this.

Why develop is red: #10186's own CI was fully green, including this exact job, but it ran at 10:17 UTC, an hour before 098721c (#10178, "Migrate public headers to CMake file sets") landed at 11:17 UTC. The relocation test was therefore never exercised against the file-set export, and the two together are what fails. cc @jpfeuffer

Where to look: either the installed export should not carry a $<BUILD_INTERFACE:…> entry at all (the file-set/include-dir wiring in cmake/add_library_macros.cmake and install_library() in cmake/install_macros.cmake), or the test should evaluate/ignore genex entries before asserting on them. I checked one obvious candidate and ruled it out: EXTERNAL_INCLUDES is passed empty at src/openms/CMakeLists.txt:304, which makes add_library_macros.cmake:152 expand to a bare $<BUILD_INTERFACE:> — but in a minimal project that exports cleanly as ${_IMPORT_PREFIX}/include, so it is not the source. Pinning the rest needs a real install tree, which I can't produce in this environment.

No re-run: the failure is deterministic and reproduced identically on three independent jobs, so a re-run would only burn another CI cycle. I'll keep watching this PR; it cannot go green until develop is fixed.


Generated by Claude Code

@timosachsenberg
timosachsenberg merged commit fd3397a into develop Sep 18, 2026
32 checks passed
@timosachsenberg
timosachsenberg deleted the claude/vigilant-meitner-cnyg0b branch September 18, 2026 19:13
timosachsenberg added a commit that referenced this pull request Sep 22, 2026
…) (#10208)

PR #10187 fixed several bugs in the Homebrew static-Boost fallback
(malformed ICU:uc target name, a possible hard configure-time error,
and a missing Apple Silicon prefix match) but never got a changelog
entry, unlike its neighboring build/packaging PRs.


Claude-Session: https://claude.ai/code/session_01WykfWw53WFsjoZV4FFHS19

Co-authored-by: Claude <[email protected]>
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.

3 participants