-
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
macOS frameworks: symbol stripping fails #11869
Comments
@trybka is currently working on a design for better Apple stripping and perhaps can comment. |
@trybka, any thoughts or updates on the iOS stripping situation? |
No thoughts beyond #13123 (comment) and https://github.com/trybka/scraps/blob/master/Apple_Stripping.md I think your commit to add @googlewalt is working on more unification of the C++ and Objc underlying rule support, and I think that will unblock the way to share more of the common idioms (like a |
Adds `-x` flag to stripping of macOS loadable bundles. Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in `error: symbols referenced by indirect symbol table entries that can't be stripped`. `-x` instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)." This should fix #11869 Closes #13314. PiperOrigin-RevId: 368841977
Adds `-x` flag to stripping of macOS loadable bundles. Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in `error: symbols referenced by indirect symbol table entries that can't be stripped`. `-x` instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)." This should fix #11869 Closes #13314. PiperOrigin-RevId: 368841977
Hi wonderful Bazel folks,
It seems something has broken in the stripping of macos_bundle in the past few versions. TL;DR: to fix the issue, I think we should pass a slightly less zealous option to strip (-x)--and maybe fix stripopts.
In more detail:
Trying to build a framework with --compilation_mode=opt leads to
error: symbols referenced by indirect symbol table entries that can't be stripped
Debug builds work fine. iOS frameworks work fine. This worked in Bazel 2.2, but is failing in 3.4.
(You do need to pass --objc_enable_binary_stripping to see the issue, since otherwise Bazel doesn't try to strip objc binaries.)
I'm pretty sure I've seen this issue in Xcode projects a long time ago, when one tries to mistakenly strip "All Symbols" instead of "Non-Global Symbols" (i.e. defaulting to
strip
instead ofstrip -x
). You can't pass this in through bazel because --strip_opt doesn't seem to work with macos_bundle...but I've confirmed manually that it fixes the issue. Apple does note in the man page for strip that "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)."Thanks so much,
Chris
The text was updated successfully, but these errors were encountered: