Commit dce2435
[apple] fix issues compiling C in objc_library for watchos/armv7k
Reproducible example here: https://github.com/dflems/bazel-repro-armv7k. This was tested against 5.0.0 rc2 and latest master and fails on both. The build succeeds after this fix is applied.
Basically, if you have any non-objc files (like C sources) in `objc_library` rules, they'll get compiled for the wrong architecture when targeting watchOS/armv7k.
The target triplet for the `watchos_armv7k` CPU was set to `armv7-apple-watchos` instead of `armv7k-apple-watchos` (which is what Xcode sets when compiling/linking for this architecture). It's been like this for a few years, but I think this has always been wrong.
Before the recent starlark rewrite of the objc rules, it appears that all of the sources (objc or not) were compiled with the `-arch armv7k` arguments applied. After the rewrite, objc still gets compiled this way but C files in the same library get the target triplet from the crosstool, which is incorrect. Then when `libtool` creates the archive, the object files are filtered out because they don't match `-arch_only armv7k`.
If approved, I think this should be cherry-picked into the 5.0 release.
Closes #14367.
PiperOrigin-RevId: 4146936411 parent 795eab3 commit dce2435
File tree
3 files changed
+3
-3
lines changed- src/test/java/com/google/devtools/build/lib/packages/util
- mock
- tools/osx/crosstool
3 files changed
+3
-3
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6991 | 6991 | | |
6992 | 6992 | | |
6993 | 6993 | | |
6994 | | - | |
| 6994 | + | |
6995 | 6995 | | |
6996 | 6996 | | |
6997 | 6997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
0 commit comments