-
Notifications
You must be signed in to change notification settings - Fork 58
Description
The Apple CC toolchain in apple_support v1.24.1 contains a bug where the literal text "STRIP_DEBUG_SYMBOLS" is emitted as a linker flag instead of the actual flag -Wl,-S. This breaks iOS cross-compilation builds when using rules_foreign_cc.
Location
crosstool/cc_toolchain_config.bzl line 766:
https://github.com/bazelbuild/apple_support/blob/1.24.1/crosstool/cc_toolchain_config.bzl#L766
flag_group(
flags = ["STRIP_DEBUG_SYMBOLS"], # ❌ This is literal text, not a valid linker flag
expand_if_available = "strip_debug_symbols",
),Impact
When building rules_foreign_cc targets (like FFTW, OpenSSL) for iOS, the configure scripts test if the C compiler works. The linker receives invalid LDFLAGS:
LDFLAGS='-lc++ STRIP_DEBUG_SYMBOLS -headerpad_max_install_names'The linker rejects STRIP_DEBUG_SYMBOLS as an unknown option, causing configure to fail with:
configure: error: C compiler cannot create executables
This completely blocks iOS cross-compilation for any project using rules_foreign_cc.
Expected Behavior
The flag should be the actual linker flag to strip debug symbols:
flag_group(
flags = ["-Wl,-S"], # ✅ Actual linker flag
expand_if_available = "strip_debug_symbols",
),Workaround
We're currently using a local patch as a workaround in our monorepo.
Environment
- apple_support version: 1.24.1
- Bazel version: 7.x
- Xcode version: 15.x+
- Platform: macOS building for iOS arm64
Reproduction
- Set up a Bazel project with
apple_support1.24.1 - Add a
rules_foreign_cctarget (e.g., FFTW) - Try to build for iOS:
bazel build --config=apple //your:ios_target - Observe the configure failure
Would appreciate a fix in an upcoming release. Happy to submit a PR if helpful!