syscontainer-tools: enable external linkmode for cgo build

Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
This commit is contained in:
zhangsong234 2021-09-02 20:59:24 +08:00 committed by holyfei
parent 365d74ffa8
commit b245817607
2 changed files with 31 additions and 4 deletions

View File

@ -0,0 +1,26 @@
From df6545261395654bdba369e23b7b4fd6705cad93 Mon Sep 17 00:00:00 2001
From: zhangsong234 <zhangsong34@huawei.com>
Date: Thu, 2 Sep 2021 20:49:07 +0800
Subject: [PATCH] enable external linkmode for cgo build
Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 792a861..5881aec 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ VERSION := $(shell cat ./VERSION)
BEP_DIR=/tmp/syscontainer-tools-build-bep
BEP_FLAGS=-tmpdir=/tmp/syscontainer-tools-build-bep
-GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
+GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -linkmode=external -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
ENV = GOPATH=${GOPATH} \
CGO_ENABLED=1 \
--
1.8.3.1

View File

@ -1,10 +1,7 @@
#Global macro or variabl
%define debug_package %{nil}
#Basic Information #Basic Information
Name: syscontainer-tools Name: syscontainer-tools
Version: 0.9 Version: 0.9
Release: 48 Release: 49
Summary: syscontainer tools for IT, work with iSulad Summary: syscontainer tools for IT, work with iSulad
License: Mulan PSL v2 License: Mulan PSL v2
URL: https://gitee.com/openeuler/syscontainer-tools URL: https://gitee.com/openeuler/syscontainer-tools
@ -13,6 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-root
Patch1: 0001-fix-failed-build-with-golang-1.15.5.patch Patch1: 0001-fix-failed-build-with-golang-1.15.5.patch
Patch2: 0002-syscontainer-tools-build-security-option.patch Patch2: 0002-syscontainer-tools-build-security-option.patch
Patch3: 0003-enable-external-linkmode-for-cgo-build.patch
#Dependency #Dependency
BuildRequires: glibc-static BuildRequires: glibc-static
@ -111,6 +109,9 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json
rm -rfv %{buildroot} rm -rfv %{buildroot}
%changelog %changelog
* Thu Sep 02 2021 zhangsong234 <zhangsong34@huawei.com> - 0.9-49
- DESC: enable external linkmode for cgo build
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 0.9-48 * Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 0.9-48
- DESC: delete -Sgit from %autosetup - DESC: delete -Sgit from %autosetup