Skip to content

Commit 825b3e8

Browse files
authored
Merge pull request #251675 from Homebrew/service-weaver-arm64-linux
service-weaver: work around patchelf.rb bug when cgo is required
2 parents f128644 + 71ea9eb commit 825b3e8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Formula/s/service-weaver.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ class ServiceWeaver < Formula
4949
conflicts_with "weaver", because: "both install a `weaver` binary"
5050

5151
def install
52+
# Workaround to avoid patchelf corruption when cgo is required (for go-sqlite3)
53+
if OS.linux? && Hardware::CPU.arch == :arm64
54+
ENV["CGO_ENABLED"] = "1"
55+
ENV["GO_EXTLINK_ENABLED"] = "1"
56+
ENV.append "GOFLAGS", "-buildmode=pie"
57+
end
58+
5259
system "go", "build", *std_go_args(ldflags: "-s -w", output: bin/"weaver"), "./cmd/weaver"
5360
resource("weaver-gke").stage do
5461
["weaver-gke", "weaver-gke-local"].each do |f|

0 commit comments

Comments
 (0)