From b0a4637ebd66e989917ae289915ff79c4e062af3 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 12 Jan 2015 11:19:53 +0100 Subject: [PATCH] build: etcd statically linked So that it can easily be used in a container. Symptoms: $ sudo bin/rkt run ../etcd/etcd-${VERSION}-linux-amd64.aci Error: Unable to open "/lib64/ld-linux-x86-64.so.2": No such file or directory --- build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build b/build index 26da5331fe2..2f9ef2bade1 100755 --- a/build +++ b/build @@ -11,7 +11,8 @@ ln -s ${PWD} $GOPATH/src/${REPO_PATH} eval $(go env) -go build -o bin/etcd ${REPO_PATH} +# Static compilation is useful when etcd is run in a container +CGO_ENABLED=0 go build -a -ldflags '-s' -o bin/etcd ${REPO_PATH} CGO_ENABLED=0 go build -a -ldflags '-s' -o bin/etcdctl ${REPO_PATH}/etcdctl go build -o bin/etcd-migrate ${REPO_PATH}/tools/etcd-migrate go build -o bin/etcd-dump-logs ${REPO_PATH}/tools/etcd-dump-logs