Skip to content

Commit 5dacb6f

Browse files
authored
Merge pull request #244491 from Homebrew/bazel-uuid
bazel: backport for Tahoe and workaround for arm64 linux
2 parents c0d350a + d47e4f7 commit 5dacb6f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Formula/b/bazel.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class Bazel < Formula
2727
uses_from_macos "zip"
2828

2929
on_linux do
30+
# Workaround for "/usr/bin/ld.gold: internal error in try_fix_erratum_843419_optimized"
31+
# Issue ref: https://sourceware.org/bugzilla/show_bug.cgi?id=31182
32+
on_arm do
33+
depends_on "lld" => :build
34+
end
35+
3036
on_intel do
3137
# We use a workaround to prevent modification of the `bazel-real` binary
3238
# but this means brew cannot rewrite paths for non-default prefix
@@ -41,6 +47,20 @@ def bazel_real
4147
end
4248

4349
def install
50+
# Backport newer apple_support to build LC_UUID needed by Tahoe
51+
# https://github.com/bazelbuild/bazel/commit/ccd3f68dc8c0bf7fc7be8c03dd070a7672e4f2b2
52+
inreplace "MODULE.bazel", '"apple_support", version = "1.18.1"', '"apple_support", version = "1.21.0"'
53+
inreplace "MODULE.bazel.lock" do |s|
54+
s.gsub! '/1.18.1/MODULE.bazel": "019f8538997d93ac84661ab7a55b5343d2758ddbff3a0501a78b573708de90b4"',
55+
'/1.21.0/MODULE.bazel": "ac1824ed5edf17dee2fdd4927ada30c9f8c3b520be1b5fd02a5da15bc10bff3e"'
56+
s.gsub! '/1.18.1/source.json": "fcfd4548abb27da98f69213a04a51cf7dab7c634f80795397f646056dab5f09f"',
57+
'/1.21.0/source.json": "028d7c853f0195e21b1323ffa2792e8fc5600da3fdaaff394fe932e0e04a4322"'
58+
end
59+
60+
# Workaround for "missing LC_UUID load command in .../xcode-locator"
61+
# https://github.com/bazelbuild/bazel/pull/27014
62+
inreplace "tools/osx/BUILD", " -Wl,-no_uuid ", " "
63+
4464
java_home_env = Language::Java.java_home_env("21")
4565

4666
ENV["EMBED_LABEL"] = "#{version}-homebrew"
@@ -63,6 +83,12 @@ def install
6383
if OS.linux? && build.bottle? && ENV["HOMEBREW_DYNAMIC_LINKER"]
6484
extra_bazel_args << "--linkopt=-Wl,--dynamic-linker=#{ENV["HOMEBREW_DYNAMIC_LINKER"]}"
6585
end
86+
87+
if OS.linux? && Hardware::CPU.arch == :arm64
88+
extra_bazel_args << "--linkopt=-fuse-ld=lld"
89+
extra_bazel_args << "--host_linkopt=-fuse-ld=lld"
90+
end
91+
6692
ENV["EXTRA_BAZEL_ARGS"] = extra_bazel_args.join(" ")
6793

6894
(buildpath/"sources").install buildpath.children

0 commit comments

Comments
 (0)