diff --git a/Makefile b/Makefile index 24c47349cc17..a56ebfd6b1be 100644 --- a/Makefile +++ b/Makefile @@ -36,10 +36,16 @@ TESTFLAGS := DUPLFLAGS := -t 100 ifeq ($(STATIC),1) -# The netgo build tag instructs the net package to try to build a -# Go-only resolver. As of Go 1.5, netgo is the default...but apparently -# not when using cgo (???). -TAGS += netgo +# Static linking with glibc is a bad time; see +# https://github.com/golang/go/issues/13470. +# If a static build is requested, assume musl is installed (it is in +# the cockroachdb/builder docker container) and link against it +# instead. +CC = /usr/local/musl/bin/musl-gcc +# `-v` so warnings from the linker aren't suppressed. +# `-a` so dependencies are rebuilt (they may have been dynamically +# linked). +GOFLAGS += -a -v LDFLAGS += -extldflags '-static' endif @@ -58,14 +64,14 @@ build: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildTag=$(shell git build: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildTime=$(shell date -u '+%Y/%m/%d %H:%M:%S')" build: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildDeps=$(shell GOPATH=${GOPATH} build/depvers.sh)" build: - $(GO) build -tags '$(TAGS)' $(GOFLAGS) -ldflags '$(LDFLAGS)' -v -i -o cockroach + $(GO) build -tags '$(TAGS)' $(GOFLAGS) -ldflags '$(LDFLAGS)' -i -o cockroach .PHONY: install install: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildTag=$(shell git describe --dirty)" install: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildTime=$(shell date -u '+%Y/%m/%d %H:%M:%S')" install: LDFLAGS += -X "github.com/cockroachdb/cockroach/util.buildDeps=$(shell GOPATH=${GOPATH} build/depvers.sh)" install: - $(GO) install -tags '$(TAGS)' $(GOFLAGS) -ldflags '$(LDFLAGS)' -v + $(GO) install -tags '$(TAGS)' $(GOFLAGS) -ldflags '$(LDFLAGS)' # Build, but do not run the tests. # PKG is expanded and all packages are built and moved to their directory. diff --git a/build/Dockerfile b/build/Dockerfile index 64002edf7e2e..70a2585ca3fd 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -7,6 +7,8 @@ RUN curl --silent --location https://deb.nodesource.com/setup_5.x | bash - && \ apt-get install --no-install-recommends --auto-remove -y git build-essential file nodejs && \ apt-get clean autoclean && \ apt-get autoremove -y && \ + curl --silent --location http://www.musl-libc.org/releases/musl-1.1.12.tar.gz | tar -xz && \ + cd musl-1.1.12 && ./configure && make && make install && \ rm -rf /tmp/* ENV SKIP_BOOTSTRAP=1 diff --git a/build/circle-deps.sh b/build/circle-deps.sh index 7378aa48eadc..f3e01feb678f 100755 --- a/build/circle-deps.sh +++ b/build/circle-deps.sh @@ -48,7 +48,7 @@ buildcache_dir=~/buildcache # The tag for the cockroachdb/builder image. If the image is changed # (for example, adding "npm"), a new image should be pushed using # "build/builder.sh push" and the new tag value placed here. -tag="20151108-172428" +tag="20151209-144441" mkdir -p "${buildcache_dir}" du -sh "${buildcache_dir}"