From 40ab0fd7f9023093a90422a93f7082f259720b00 Mon Sep 17 00:00:00 2001
From: yangjiaqi <yangjiaqi16@huawei.com>
Date: Mon, 19 Sep 2022 18:12:26 +0800
Subject: [PATCH] fix compile problem and make rubik real static

---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7cd1185..6ba4edf 100644
--- a/Makefile
+++ b/Makefile
@@ -29,8 +29,10 @@ LD_FLAGS := -ldflags '-buildid=none -tmpdir=$(TMP_DIR) \
 	-X isula.org/rubik/pkg/version.Version=$(VERSION) \
 	-X isula.org/rubik/pkg/version.Release=$(RELEASE) \
 	-X isula.org/rubik/pkg/version.Usage=$(USAGE) \
-	-extldflags=-ftrapv \
-	-extldflags=-Wl,-z,relro,-z,now -linkmode=external -extldflags=-static'
+	-buildmode=pie \
+	-extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow \
+	-linkmode=external \
+	-extldflags "-static-pie -Wl,-z,now"'
 
 export GO111MODULE=on
 
@@ -39,7 +41,7 @@ GO_BUILD=CGO_ENABLED=1 \
 	CGO_CPPFLAGS="-fstack-protector-strong -fPIE" \
 	CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \
 	CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \
-	go build -mod=vendor -buildmode=pie
+	go build -mod=vendor
 
 all: release
 
-- 
2.30.0

