From d86ccfa3b0b8772dd5f299baf78ade071854afd0 Mon Sep 17 00:00:00 2001 From: Samuel Alfageme Date: Thu, 20 May 2021 11:14:32 +0200 Subject: [PATCH] Fix: use the -static ldflag only for the 'build-ci' target (#1718) --- Makefile | 7 ++++--- changelog/unreleased/fix-static-ldflag-build-ci.md | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/fix-static-ldflag-build-ci.md diff --git a/Makefile b/Makefile index 17f9350d47d..62553326c41 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "dirty-"` VERSION=`git describe --always` GO_VERSION=`go version | awk '{print $$3}'` -BUILD_FLAGS="-w -extldflags "-dynamic" -X main.gitCommit=${GIT_COMMIT} -X main.version=${VERSION} -X main.goVersion=${GO_VERSION} -X main.buildDate=${BUILD_DATE}" +BUILD_FLAGS="-X main.gitCommit=${GIT_COMMIT} -X main.version=${VERSION} -X main.goVersion=${GO_VERSION} -X main.buildDate=${BUILD_DATE}" +CI_BUILD_FLAGS="-w -extldflags "-static" -X main.gitCommit=${GIT_COMMIT} -X main.version=${VERSION} -X main.goVersion=${GO_VERSION} -X main.buildDate=${BUILD_DATE}" LITMUS_URL_OLD="http://localhost:20080/remote.php/webdav" LITMUS_URL_NEW="http://localhost:20080/remote.php/dav/files/4c510ada-c86b-4815-8820-42cdf82c3d51" LITMUS_USERNAME="einstein" @@ -76,8 +77,8 @@ deps: cd /tmp && go get golang.org/x/tools/cmd/goimports build-ci: off - go build -ldflags ${BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad - go build -ldflags ${BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva + go build -ldflags ${CI_BUILD_FLAGS} -o ./cmd/revad/revad ./cmd/revad + go build -ldflags ${CI_BUILD_FLAGS} -o ./cmd/reva/reva ./cmd/reva lint-ci: go run tools/check-license/check-license.go diff --git a/changelog/unreleased/fix-static-ldflag-build-ci.md b/changelog/unreleased/fix-static-ldflag-build-ci.md new file mode 100644 index 00000000000..4b00f53493b --- /dev/null +++ b/changelog/unreleased/fix-static-ldflag-build-ci.md @@ -0,0 +1,7 @@ +Bugfix: Use the -static ldflag only for the 'build-ci' target + +It is not intended to statically link the generated binaries +for local development workflows. This resulted on segmentation +faults and compiller warnings. + +https://github.com/cs3org/reva/pull/1718