-
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
Fix versioned shared libraries for macOS toolchain #20847
Fix versioned shared libraries for macOS toolchain #20847
Conversation
Is this cherry-picking a mainline commit? If so, could you link to it in the PR description? |
Not checked in yet in mainline. I will do that first and add it to the description. |
The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in #20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597366229 Change-Id: Ib7cf237cb6c58a69e781197408d3f703010909da
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.
it's probably not worth changing but this bug is also in the legacy toolchain features
I agree with your assessment about it not being worth it. Thank you very much for the guidance and review Keith. |
@keith I bumped into an issue with just listing the path that I don' t know how to work around. If a library is linked by just listing the path, the See here:
There is no entry for
I tried a couple of things, like adding renamed_so_file_2.so behind every runtime library search directory, i.e:
and adding I'm out of ideas about how one is supposed to link a custom named dynamic library in macOS and have everything work. For such a basic thing, it feels like there must be a way. If you want to try it out, you can clone this commit from my repository, then remove the suffix from every BUILD file in
|
Someone pointed out to me that the problem is here: bazel/tools/cpp/osx_cc_wrapper.sh.tpl Line 39 in 8dd0998
We won't have the full path library in LIBS anymore, therefore in the loop at the bottom where we call install_name_tool it won't be listed. I will fix the script now to take into account this path as well. |
that script sounds right. alternatively we could try again to flip this flag https://github.com/bazelbuild/apple_support/blob/d87e8b07f3345e750834dbb6ce38c7c7d3b8b44b/crosstool/cc_toolchain_config.bzl#L2305-L2324 which I think would also solve it, but last I checked there was some sort of issue |
Running tests now but the failure is gone locally. I don't think we need the sentinel value. I added code to parse everything ending in If everything passes, I think this is good enough. The fix to the bash script also needs to go in at head as far as I understand because apple_support is still using it, isn't it? But I wouldn't delay merging this PR for that. |
yes this script is also used by the default C++ toolchain on macOS even without the apple_support toolchain, so definitely needed at head as well. I can update the features in the apple_support toolchain assuming using that new variable is backwards compatible as long as it's unused (since no one must be using it today with this issue) |
Mirrors bazelbuild/bazel#20847 This variable isn't supported until the linked change, but if anyone hit this codepath today it wouldn't work either so it's safe to use since it just changes the error message to something else.
looks like it's fine to do now bazelbuild/apple_support#292 |
29bbe31
The commit f0ade80 was missing some required changes. The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in #20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597810345 Change-Id: Ic88feaabdde05143ab145e997de1ef9487af83fd
Mirrors bazelbuild/bazel#20847 This variable isn't supported until the linked change, but if anyone hit this codepath today it wouldn't work either so it's safe to use since it just changes the error message to something else.
Baseline: 50b61e3 Release Notes: + Fix tree file materialized as symlink to another file when building without the bytes. (#20409) + Don't pass --add-opens= to javac (#20472) + Flip --incompatible_visibility_private_attributes_at_definition (#20520) + Fix extraction of tar archives containing sparse files. (#20531) + RemoteSpawnRunner: record inbetween phases in timing profile (#20550) + Add profiling to `remoteActionBuildingSemaphore.acquire()` (#20549) + The label API shakeup & docs cleanup (#20590) + Disable rewriter test (#20758) + Disable PyTest.testSmoke on macOS (#20729) + Upgrade abseil-cpp to fix build on macos_arm64 (#20785) + Ignore read-only errors when updating the `mtime` of the `install_base` (#20568) + Restart at most once when prepopulating repository rule environment (#20667) + Fix bootstrapped Bazel binary (#20804) + Add flag `experimental_throttle_remote_action_building` (#20861) + Fix versioned shared libraries for macOS toolchain (#20847) + Proto toolchainisation cherrypicks (#20925) Acknowledgements: This release contains contributions from many people at Google, as well as bazel.build machine account, Brentley Jones, Fabian Meumertzheim, Jordan Mele, Mai Hussien, oquenchil, Rahul Butani, Son Luong Ngoc, Xùdōng Yáng.
Baseline: 50b61e3 Release Notes: + Fix tree file materialized as symlink to another file when building without the bytes. (#20409) + Don't pass --add-opens= to javac (#20472) + Flip --incompatible_visibility_private_attributes_at_definition (#20520) + Fix extraction of tar archives containing sparse files. (#20531) + RemoteSpawnRunner: record inbetween phases in timing profile (#20550) + Add profiling to `remoteActionBuildingSemaphore.acquire()` (#20549) + The label API shakeup & docs cleanup (#20590) + Disable rewriter test (#20758) + Disable PyTest.testSmoke on macOS (#20729) + Upgrade abseil-cpp to fix build on macos_arm64 (#20785) + Ignore read-only errors when updating the `mtime` of the `install_base` (#20568) + Restart at most once when prepopulating repository rule environment (#20667) + Fix bootstrapped Bazel binary (#20804) + Add flag `experimental_throttle_remote_action_building` (#20861) + Fix versioned shared libraries for macOS toolchain (#20847) + Proto toolchainisation cherrypicks (#20925) Acknowledgements: This release contains contributions from many people at Google, as well as bazel.build machine account, Brentley Jones, Fabian Meumertzheim, Jordan Mele, Mai Hussien, oquenchil, Rahul Butani, Son Luong Ngoc, Xùdōng Yáng.
@bazel-io flag |
it looks like this is in the 6.x tree but not 7.x 😭 |
@bazel-io fork 7.3.0 |
The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in bazelbuild#20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597366229 Change-Id: Ib7cf237cb6c58a69e781197408d3f703010909da
The commit f0ade80 was missing some required changes. The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in bazelbuild#20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597810345 Change-Id: Ic88feaabdde05143ab145e997de1ef9487af83fd
The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in bazelbuild#20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597366229 Change-Id: Ib7cf237cb6c58a69e781197408d3f703010909da
The commit f0ade80 was missing some required changes. The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed. To add a proper test like in bazelbuild#20847, this change must first be checked in, the Apple toolchain needs to be updated and then the test can be added. RELNOTES:none PiperOrigin-RevId: 597810345 Change-Id: Ic88feaabdde05143ab145e997de1ef9487af83fd
The toolchain was passing -l:name. This mechanism doesn' t exist on macOS, instead the full path to the shared library should be passed.
Mainline commit: f0ade80
As it says on that mainline commit, it cannot be checked in with a test unlike this PR, because the macOS toolchain was moved outside of Bazel. Therefore, the change must go in, the macOS toolchain needs to be updated, then the test can be added. This change does go in with a test because the toolchain is still embedded in Bazel for 6.5.
Fixes #20487