Skip to content

Commit

Permalink
bazel_7: re-enable arc in xcode_locator command
Browse files Browse the repository at this point in the history
  • Loading branch information
layus committed Dec 14, 2023
1 parent 6d93cdd commit 0d222a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 40 deletions.
10 changes: 3 additions & 7 deletions pkgs/development/tools/build-managers/bazel/bazel_7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,9 @@ stdenv.mkDerivation rec {
# I do not know yet how to allow IOPMAssertion{CreateWithName,Release}
./darwin_sleep.patch

# Make DARWIN_XCODE_LOCATOR_COMPILE_COMMAND behave properly by diabling
# multi-arch support and using proper /usr/bin paths that will get fixed
# below.
# Also, xcode_locator requires arc support, but it seems pretty difficult
# to provide, so we disable it altogether for xcode_locator. Caveat: this
# leaks memory, but we accept this fact because xcode_locator is only a
# short-lived process used during the build.
# Fix DARWIN_XCODE_LOCATOR_COMPILE_COMMAND by removing multi-arch support.
# Nixpkgs toolcahins do not support that (yet?) and get confused.
# Also add an explicit /usr/bin prefix that will be patched below.
./xcode_locator.patch

# On Darwin, the last argument to gcc is coming up as an empty string. i.e: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,13 @@
diff --git a/tools/osx/BUILD b/tools/osx/BUILD
index 0358fb0ffe..baae1bf65b 100644
--- a/tools/osx/BUILD
+++ b/tools/osx/BUILD
@@ -27,9 +27,8 @@ exports_files([
])
@@ -28,8 +28,8 @@ exports_files([

DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """
- /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.13 -fobjc-arc -framework CoreServices \
/usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.13 -fobjc-arc -framework CoreServices \
- -framework Foundation -arch arm64 -arch x86_64 -Wl,-no_adhoc_codesign -Wl,-no_uuid -o $@ $< && \
+ -framework Foundation -Wl,-no_adhoc_codesign -Wl,-no_uuid -o $@ $< && \
- env -i codesign --identifier $@ --force --sign - $@
+ /usr/bin/xcrun --sdk macosx clang -framework CoreServices -framework Foundation -Wl,-no_uuid -o $@ $< && \
+ /usr/bin/env -i /usr/bin/codesign --identifier $@ --force --sign - $@
"""

genrule(
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl
index a4a712a341..dfbf4869a9 100644
--- a/tools/osx/xcode_configure.bzl
+++ b/tools/osx/xcode_configure.bzl
@@ -135,7 +135,6 @@ def run_xcode_locator(repository_ctx, xcode_locator_src_label):
"macosx",
"clang",
"-mmacosx-version-min=10.13",
- "-fobjc-arc",
"-framework",
"CoreServices",
"-framework",
diff --git a/tools/osx/xcode_locator.m b/tools/osx/xcode_locator.m
index c602b0bb4b..1f7eb64810 100644
--- a/tools/osx/xcode_locator.m
+++ b/tools/osx/xcode_locator.m
@@ -21,10 +21,6 @@
// 6,6.4,6.4.1 = 6.4.1
// 6.3,6.3.0 = 6.3

-#if !defined(__has_feature) || !__has_feature(objc_arc)
-#error "This file requires ARC support."
-#endif
-
#import <CoreServices/CoreServices.h>
#import <Foundation/Foundation.h>

0 comments on commit 0d222a3

Please sign in to comment.