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 of strip -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
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 strippedDebug 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
stripinstead 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