Warn about missing libraries in brew info#22849
Open
HaraldNordgren wants to merge 3 commits into
Open
Conversation
When a dependency's soname bumps and the old dylib is removed, an installed formula's binaries can be left linking against a library that no longer exists, aborting at load time with a dyld error. Surface this in the `brew info` Dependencies section for installed formulae as a "Missing libraries" line, marking each library with a red ✘ like other dependency statuses. The fix suggestion is `brew upgrade` when the formula is outdated (which also relinks it) and `brew reinstall` otherwise. The libraries are read from the existing LinkageChecker, combining broken dependencies (dylibs under opt/<dep>/) and broken dylibs that map to no dependency.
|
Thanks for your pull request. This has been closed because it appears to use an incomplete or outdated pull request template. Please edit this pull request to fill in the current pull request template. This workflow will reopen this pull request automatically once the template is complete. Do not open a new pull request for this. |
Contributor
Author
|
Benchmarks: |
MikeMcQuaid
reviewed
Jun 22, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Thanks! Can you benchmark this on big formulae/those with lots of linkage e.g. ffmpeg-full, llvm, boost?
| kegs = shadowing_formula ? [] : formula.installed_kegs | ||
| installed = kegs.any? | ||
| outdated = installed && formula.outdated? | ||
| missing_libraries, missing_library_deps = installed ? formula.missing_library_linkage : [[], Set.new] |
Member
There was a problem hiding this comment.
Avoid ternary here, I think it makes it harder to read. Would prefer ||= on both variables.
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
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.
This bit me when on an old version of ffmpeg, after upgrading it it started working. So I can't reproduce the exact issue.
But manually breaking a library to show what it looks like:
mv /Users/Harald/git-repos/github.com/Homebrew/brew/Cellar/gmp/6.3.0/lib/libgmp.10.dylib{,.bak}brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claud Code wrote the code with my guidance.