-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fixes incorrect install names on darwin platforms #13427
Conversation
#12304 added support to bazel for setting install names for dynamic libraries on darwin platforms. This would set LC_ID_DYLIB to @rpath/{library_name}, so that RPATH would be used to locate these libraries at runtime. However, the code was using a utility method that assumed the library name was mangled, which is often not the case. Given that the output path should already have been determined with the mangled or unmangled name, we should be able to just use the base name of the artifact. The test that was added in #12304 has been updated to actually use dynamic libaries, and passes with the changes made in this commit.
@oquenchil, have you had the chance to look at this? |
It looks like this change affects more than darwin, but all Bazel presubmits and internal tests pass so it can go in. I may have to rollback though. |
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.
LGTM
Runtime linking with rpaths works correctly on darwin with only this change, for dylibs that have the correct extension (dylib) and the correct rpath configuration. Runtime linking against dynamic libraries created by bazel targets remains broken, due to them not having install names set correctly. That is fixed by using --incompatible_macos_set_install_name after bazelbuild/bazel#13427.
#12304 added support to bazel for setting install names for dynamic libraries on darwin platforms. This would set LC_ID_DYLIB to @rpath/{library_name}, so that RPATH would be used to locate these libraries at runtime. However, the code was using a utility method that assumed the library name was mangled, which is often not the case. Given that the output path should already have been determined with the mangled or unmangled name, we should be able to just use the base name of the artifact. The test that was added in #12304 has been updated to actually use dynamic libaries, and passes with the changes made in this commit. Closes #13427. PiperOrigin-RevId: 377504015
I just ran into this issue (runtime_solib_name is not the mangled name) after upgrading to bazel 5.1 from 4.2. Any reason this did not land? edit: actually it turns out this PR caused my issues, see #15214 |
#12304 added support to bazel for setting install names for dynamic
libraries on darwin platforms. This would set LC_ID_DYLIB to
@rpath/{library_name}, so that RPATH would be used to locate these
libraries at runtime. However, the code was using a utility method that
assumed the library name was mangled, which is often not the case. Given
that the output path should already have been determined with the
mangled or unmangled name, we should be able to just use the base name
of the artifact. The test that was added in #12304 has been updated to
actually use dynamic libaries, and passes with the changes made in this
commit.