From d98995f25c3a839f25590478bef37d2a456593a3 Mon Sep 17 00:00:00 2001
From: jikui <jikui2@huawei.com>
Date: Mon, 22 Mar 2021 17:07:37 +0800
Subject: [PATCH] kata-agent: add linkmode to resolve build error

reason: add linkmode to resolve build error

Signed-off-by: jikui <jikui2@huawei.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 26fe898..5401c69 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ INIT := no
 TRACE := no
 
 # Set to "yes“ if binary stripping is needed.
-STRIP := no
+STRIP := yes
 
 # Tracing cannot currently be supported when running the agent as PID 1 since
 # the tracing requires additional services to be started _before_ the agent
@@ -105,7 +105,7 @@ $(TARGET): $(GENERATED_FILES) $(SOURCES) $(VERSION_FILE)
 	CGO_LDFLAGS_ALLOW="-Wl,-z,relro,-z,now" \
 	CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \
 	go build $(BUILDFLAGS) -tags "$(BUILDTAGS)" -o $@ \
-		-ldflags "-X main.version=$(VERSION_COMMIT) -X main.seccompSupport=$(SECCOMP) $(LDFLAGS) $(KATA_LDFLAGS)"
+		-ldflags "-linkmode=external -X main.version=$(VERSION_COMMIT) -X main.seccompSupport=$(SECCOMP) $(LDFLAGS) $(KATA_LDFLAGS)"
 
 install: $(TARGET)
 	install -D $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
-- 
2.25.1

