Skip to content

Instantly share code, notes, and snippets.

@codyps
Created October 26, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codyps/5a8dec1b14f1869d7882feb1bd7832ea to your computer and use it in GitHub Desktop.
Save codyps/5a8dec1b14f1869d7882feb1bd7832ea to your computer and use it in GitHub Desktop.
0001-use-linkmode-external-to-fix-build.patch
From d4c957869206eb9888d48fcd9e4570c3d8d01bc2 Mon Sep 17 00:00:00 2001
From: Cody Schafer <cody@berkshiregrey.com>
Date: Mon, 26 Oct 2020 12:51:38 -0400
Subject: [PATCH] use linkmode external to fix build
Otherwise, the link fails:
.rela: relocation target _cgo_26061493d47f_C2func_getaddrinfo not defined
The `-linkmode external` option is included in the current go packaging
guidelines
---
PKGBUILD | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PKGBUILD b/PKGBUILD
index 614097d..3c64ebc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -61,7 +61,7 @@ build() {
# because argument expansion with quoting in bash is hard, and -ldflags=-extldflags='-foo'
# is not exactly the same as -ldflags "-extldflags '-foo'" use the array trick
# to pass exactly what we want
- flags=(-buildmode=pie -ldflags "-s -extldflags '$LDFLAGS'" -trimpath)
+ flags=(-buildmode=pie -ldflags "-s -linkmode external -extldflags '$LDFLAGS'" -trimpath)
staticflags=(-buildmode=pie -ldflags "-s -linkmode external -extldflags '$LDFLAGS -static'" -trimpath)
# Build/install snap and snapd
go build "${flags[@]}" -o "$srcdir/go/bin/snap" "${_gourl}/cmd/snap"
--
2.29.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment