From 81ada1744b16648d7c7d39413f5c618751b57851 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Mon, 23 Jan 2023 16:46:39 -0500 Subject: [PATCH] cgo needs a compiler --- projects/ipfs.tech/ldflags.diff | 12 ++++++++++++ projects/ipfs.tech/package.yml | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 projects/ipfs.tech/ldflags.diff diff --git a/projects/ipfs.tech/ldflags.diff b/projects/ipfs.tech/ldflags.diff new file mode 100644 index 00000000..a8eca023 --- /dev/null +++ b/projects/ipfs.tech/ldflags.diff @@ -0,0 +1,12 @@ +diff -ru a/cmd/ipfs/Rules.mk b/cmd/ipfs/Rules.mk +--- a/cmd/ipfs/Rules.mk 2023-01-23 17:23:00 ++++ b/cmd/ipfs/Rules.mk 2023-01-23 17:23:21 +@@ -13,7 +13,7 @@ + # DEPS_OO_$(d) += merkledag/pb/merkledag.pb.go namesys/pb/namesys.pb.go + # DEPS_OO_$(d) += pin/internal/pb/header.pb.go unixfs/pb/unixfs.pb.go + +-$(d)_flags =-ldflags="-X "github.com/ipfs/kubo".CurrentCommit=$(git-hash)" ++$(d)_flags =-ldflags="-X "github.com/ipfs/kubo".CurrentCommit=$(git-hash) -buildmode=pie" + + $(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags) + diff --git a/projects/ipfs.tech/package.yml b/projects/ipfs.tech/package.yml index 1ae0f92c..e8d4ec9f 100644 --- a/projects/ipfs.tech/package.yml +++ b/projects/ipfs.tech/package.yml @@ -11,8 +11,16 @@ versions: build: dependencies: tea.xyz/gx/make: '*' + tea.xyz/gx/cc: c99 go.dev: 1 + gnu.org/patch: '*' script: | + if test "{{hw.platform}}" = "linux"; then + # Need to pass -buildmode=pie to the build + # or segmentation fault + # fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575 + patch -p1