From 99d9a24a515a04f3cacf6008f2d22a0656fddcef Mon Sep 17 00:00:00 2001 From: bin Date: Tue, 2 Feb 2021 14:47:21 +0800 Subject: [PATCH] kata-monitor: set buildmode to exe to avoid build failing CGO_ENABLED=0 and -buildmode=pie are not compatible and may lead build failing in some OS. Specify buildmode=exe to overwrite the value set in BUILDFLAGS Fixes: #1343 Signed-off-by: bin Signed-off-by: Peng Tao --- src/runtime/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime/Makefile b/src/runtime/Makefile index 0c03b7065f..d3d415a329 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -600,8 +600,9 @@ $(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG)) $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) -$(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) - $(QUIET_BUILD)(cd $(MONITOR_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) +$(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) .git-commit + $(QUIET_BUILD)(cd $(MONITOR_DIR)/ && CGO_ENABLED=0 go build \ + --ldflags "-X main.GitCommit=$(shell cat .git-commit)" $(BUILDFLAGS) -buildmode=exe -o $@ .) .PHONY: \ check \