-
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
Revert "Fixes incorrect install names on darwin platforms" #15261
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
6f7b174
to
5b88a98
Compare
5b88a98
to
98efcca
Compare
@keith could you please take a look? |
should we get input from @csmulhern here who originally implemented this in case there's an easy way to fix this foward? |
FYI, I pinged him on #15214 9 days ago. Maybe someone has an internal Google way of contacting him? |
Friendly ping sent to @csmulhern . |
Sorry for the delayed response. I'm not actually a bazel engineer, so I'm sure there are people with better context here than me. My motivation for the original change was to fix issues I was experiencing with --incompatible_macos_set_install_name, as detailed in b06f495. TL;DR: When using In that case, it seems the correct fix would be to basically use the original code:
but to set preserveName based on whether the filename will be mangled or not (which doesn't seem straightforward to figure out). It would be good to get input from a bazel engineer who knows when this would or would not be the case. |
For reference, here is what I observe when running the existing test at HEAD today.
As you can see, the test binary has its RPATH set to the solib symlink directory. The dynamic libraries are located by searching the RPATH, and the library names in the binary (and the symlink names) are unmangled. |
And with this change:
The test fails as the library names are wrong (e.g. libtest_Slibbar.so in the binary, but libbar.so in the solib symlink directory). |
Note: the above output is when using When not using this flag, the binary locates the shared libraries using @loader_path, and this behavior is the same with or without this change.
|
The test that was introduced in b06f495 is IMO a little borderline. The docs for cc_binary.linkshared explicitly state
so since you are technically not supposed to link to such a binary, only dlopen it, it does not matter what its install_name is. The whole point of Unfortunately, between the time that #12304 was committed and the time that #13427 was submitted, the default darwin toolchain stopped using |
Thanks for bringing that to my attention. What would be the appropriate test case then? Is there existing infrastructure for testing with a custom toolchain that has If I have a prebuilt dylib that I bring in to bazel using cc_import, I believe that will also result in an unmangled name, and that this should be a supported use case. As such, we would still want to support mangled and unmangled names within |
There are no link actions for a prebuilt dylib, so I'm not sure how you would use |
You're right. I was under the impression that I think going ahead and reverting sounds like the right course of action here then, which should fix cc toolchains using |
Don't get me wrong, I think that the ideal scenario is for |
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
@bazel-io flag |
@bazel-io fork 5.2.0 |
This reverts commit b06f495. Also had to add a missing mnemonic function call parameter to `getDynamicLibrarySoname`. Copy-pasted the parameter from the other use of that function in the codebase. Tested manually with a custom toolchain and there is also a test from the reverted code. Fixes #15214 Closes #15261. PiperOrigin-RevId: 446662219 Co-authored-by: Chris Clearwater <[email protected]>
This reverts commit b06f495. Also had to add a missing mnemonic function call parameter to `getDynamicLibrarySoname`. Copy-pasted the parameter from the other use of that function in the codebase. Tested manually with a custom toolchain and there is also a test from the reverted code. Fixes #15214 Closes #15261. PiperOrigin-RevId: 446662219 Co-authored-by: Chris Clearwater <[email protected]>
This reverts commit b06f495.
Also had to add a missing mnemonic function call parameter to
getDynamicLibrarySoname
. Copy-pasted the parameter from the other use of that function in the codebase.Tested manually with a custom toolchain and there is also a test from the reverted code.
Fixes #15214