[CMake] Link only what is used: drop unused explicit library deps#22669
Open
guitargeek wants to merge 1 commit into
Open
[CMake] Link only what is used: drop unused explicit library deps#22669guitargeek wants to merge 1 commit into
guitargeek wants to merge 1 commit into
Conversation
Address root-project#20731 by removing explicitly-linked-but-unused libraries reported by `ldd -u`. The recurring offenders all came from foundational libraries exporting internal-only dependencies through their PUBLIC link interface (CMake DEPENDENCIES), so every consumer inherited them. These are now PRIVATE (CMake LIBRARIES), and genuinely-spurious links dropped: * RIO: Thread -> `PRIVATE` (TFilePrefetch only holds a TThread* member) * Tree: Imt/Net/MathCore -> `PRIVATE`, declares its own Thread (RIO stays PUBLIC: TBufferSQL/TTreeCache derive from RIO types) * RHTTP/HistPainter/RooStats/RooFitMore/RCsg: internal deps -> PRIVATE * Hbook/Spectrum/HistFactory: spurious Matrix/Foam removed * ntuple_merger/stressRooFit tests: declare the deps they actually use RIO -> Thread alone cuts Thread over-linking from 62 reports to 2; in total the tree drops from 510 reports (77 libs) to 422 (69), and every library still links cleanly under `-Wl`, `--no-undefined`. This closes root-project#20731: the remaining reports are not over-linking and PUBLIC/PRIVATE cannot remove them. They are either inline-header dependencies (e.g. Tree using TMath: a real compile dependency with no exported symbol, which `ldd -u` mis-flags) or deliberate public API (Hist exposes TVectorD/TMatrixD; TMessage derives from TBufferFile). Closes root-project#20731. 🤖 Done with the help of AI.
Test Results2 603 tests 2 603 ✅ 1h 9m 49s ⏱️ Results for commit ff35da8. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address #20731 by removing explicitly-linked-but-unused libraries reported by
ldd -u. The recurring offenders all came from foundational libraries exporting internal-only dependencies through their PUBLIC link interface (CMake DEPENDENCIES), so every consumer inherited them. These are now PRIVATE (CMake LIBRARIES), and genuinely-spurious links dropped:PRIVATE(TFilePrefetch only holds a TThread* member)PRIVATE, declares its own Thread(RIO stays PUBLIC: TBufferSQL/TTreeCache derive from RIO types)
RIO -> Thread alone cuts Thread over-linking from 62 reports to 2; in total the tree drops from 510 reports (77 libs) to 422 (69), and every library still links cleanly under
-Wl,--no-undefined.This closes #20731: the remaining reports are not over-linking and PUBLIC/PRIVATE cannot remove them. They are either inline-header dependencies (e.g. Tree using TMath: a real compile dependency with no exported symbol, which
ldd -umis-flags) or deliberate public API (Hist exposes TVectorD/TMatrixD; TMessage derives from TBufferFile).Closes #20731.
🤖 Done with the help of AI.