-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linkage_checker: skip broken linkage in Julia #18235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
Can you talk about what's broken about Julia currently? We already have it shipped in homebrew-core with passing linkage. I feel quite strongly that We did have a DSL allowlist for skipping missing library checks in the past but we removed it because we ended up fixing the underlying issues. Is there anything except Julia that would use this? If it's only Julia we might as well hardcode in |
We shipped it with broken linkage when check was just a warning - The Linux broken linkage covers the same failure as macOS missing RPATHs. It's just that the missing RPATHs are detected by finding
Not sure about others. We could hardcode in Julia. Right now, the dylibs in that directory are not intended to be used with native dynamic loader which is why they trigger linkage error. I think they are run through Julia's loader instead. |
RPATH check is still a warning and isn't going to graduate soon (see e.g. GCC) which is why there was the suggestion of moving it to Not sure about Linux - I would have expected that to fail. It would however make sense to adjust the Linux checking to align better with macOS. I don't think we should ever allow ignoring broken linkage on macOS. Maybe that just means making a |
Perhaps to illustrate the point better: This linkage check runs even when you are running Strict mode can contain false positives, though is probably overdue reevaluating what's there and why. |
Currently it does fail so probably fixed (or at least elevated from warning), e.g.
I guess easiest path for now is the hardcoding of Julia. Moving it to |
cb96fbc
to
33914a1
Compare
33914a1
to
052de4e
Compare
052de4e
to
ae075e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May as well add && !broken_dylibs_allowed?(file)
here too:
brew/Library/Homebrew/linkage_checker.rb
Line 131 in f0be97f
@files_missing_rpaths << file if pathname.rpaths.empty? |
ae075e3
to
dd25679
Compare
On topic of Julia but unrelated to this PR, it may be nice to detect symlinks to other formulae and use that to avoid some "Dependencies with no linkage". Julia does this for most dependencies thus we get:
❯ eza -1 $(brew --prefix julia)/lib/julia/ | rg ' -> \.\.'
libatomic.1.dylib -> ../../../../../opt/gcc/lib/gcc/current/libatomic.1.dylib
libblastrampoline.dylib -> ../../../../../opt/libblastrampoline/lib/libblastrampoline.5.dylib
libcurl.dylib -> ../../../../../opt/curl/lib/libcurl.4.dylib
libgcc_s.1.1.dylib -> ../../../../../opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib
libgfortran.5.dylib -> ../../../../../opt/gcc/lib/gcc/current/libgfortran.5.dylib
libgit2.dylib -> ../../../../../opt/libgit2/lib/libgit2.1.8.dylib
libgmp.dylib -> ../../../../../opt/gmp/lib/libgmp.10.dylib
libgomp.1.dylib -> ../../../../../opt/gcc/lib/gcc/current/libgomp.1.dylib
libmbedcrypto.dylib -> ../../../../../opt/mbedtls@2/lib/libmbedcrypto.7.dylib
libmbedtls.dylib -> ../../../../../opt/mbedtls@2/lib/libmbedtls.14.dylib
libmbedx509.dylib -> ../../../../../opt/mbedtls@2/lib/libmbedx509.1.dylib
libmpfr.dylib -> ../../../../../opt/mpfr/lib/libmpfr.6.dylib
libnghttp2.dylib -> ../../../../../opt/libnghttp2/lib/libnghttp2.14.dylib
libopenblas.dylib -> ../../../../../opt/openblas/lib/libopenblas.0.dylib
libopenlibm.dylib -> ../../../../../opt/openlibm/lib/libopenlibm.4.dylib
libpcre2-8.dylib -> ../../../../../opt/pcre2/lib/libpcre2-8.0.dylib
libquadmath.0.dylib -> ../../../../../opt/gcc/lib/gcc/current/libquadmath.0.dylib
libssh2.dylib -> ../../../../../opt/libssh2/lib/libssh2.1.dylib
libssp.0.dylib -> ../../../../../opt/gcc/lib/gcc/current/libssp.0.dylib
libstdc++.6.dylib -> ../../../../../opt/gcc/lib/gcc/current/libstdc++.6.dylib |
It's nice, but doesn't seem worth the extra code since no other formula does this. |
It would work for things like Maybe also Also related would be header usage (e.g. |
That's fair.
Header-only usage should probably just be |
@@ -92,6 +92,13 @@ def dylib_to_dep(dylib) | |||
Regexp.last_match(2) | |||
end | |||
|
|||
sig { params(file: String).returns(T::Boolean) } | |||
def broken_dylibs_allowed?(file) | |||
return false if formula.name != "julia" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed there is some logic afterward that checks if formula
. I guess there is a chance formula will not be resolved?
brew/Library/Homebrew/linkage_checker.rb
Lines 317 to 320 in 5b0a84b
def resolve_formula(keg) | |
Formulary.from_keg(keg) | |
rescue FormulaUnavailableError | |
opoo "Formula unavailable: #{keg.name}" |
If so, can modify to check if formula.blank? && ...
EDIT: Most likely typechecking will fail once we add strict typing. Can look into adding types along with handling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just do
if formula&.name != "julia"
Thanks @cho-m! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Looking into a way to avoid Julia linkage errors since it uses its own dylib lookup logic which brew considers broken linkage.
Seemed to be easier approach rather than trying to inject unneeded RPATHs into the binary that Julia doesn't want.
Example for Julia:
Need to try out a few more things and check on Linux code path.