diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d6ec50c24e..0781a9f6892 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ commands: steps: - run: name: Install clang - command: sudo apt-get install -y --no-install-recommends clang + command: sudo apt-get install -y --no-install-recommends clang musl-tools - run: name: Install rust compiler command: | @@ -42,7 +42,8 @@ commands: - run: name: Install additional rust targets command: | - rustup target add aarch64-unknown-linux-gnu \ + rustup target add x86_64-unknown-linux-musl \ + aarch64-unknown-linux-gnu \ arm-unknown-linux-gnueabihf \ armv7-unknown-linux-gnueabihf \ x86_64-apple-darwin diff --git a/.goreleaser.yml b/.goreleaser.yml index d1cb259c5c3..9d7880e9e07 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,13 +8,16 @@ builds: - amd64 - arm64 main: ./cmd/influx/ + flags: + - -tags={{if and (eq .Os "linux") (eq .Arch "amd64")}}osusergo,netgo,static_build{{end}} env: - GO111MODULE=on - CGO_ENABLED=1 - CC=xcc - PKG_CONFIG=$GOPATH/bin/pkg-config - MACOSX_DEPLOYMENT_TARGET=10.11 - ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if and (eq .Os "linux") (eq .Arch "amd64")}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}} binary: influx - id: influxd goos: @@ -25,14 +28,15 @@ builds: - arm64 main: ./cmd/influxd/ flags: - - -tags=assets + - -tags=assets{{if and (eq .Os "linux") (eq .Arch "amd64")}},osusergo,netgo,static_build{{end}} env: - GO111MODULE=on - CGO_ENABLED=1 - CC=xcc - PKG_CONFIG=$GOPATH/bin/pkg-config - MACOSX_DEPLOYMENT_TARGET=10.11 - ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} + ldflags: + - -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} {{if and (eq .Os "linux") (eq .Arch "amd64")}}-extldflags "-fno-PIC -static -Wl,-z,stack-size=8388608"{{end}} binary: influxd hooks: pre: make generate diff --git a/xcc.sh b/xcc.sh index bbc89145a62..b7f85aa71c6 100755 --- a/xcc.sh +++ b/xcc.sh @@ -9,7 +9,7 @@ GOOS=${GOOS:-$(go env GOOS)} GOARCH=${GOARCH:-$(go env GOARCH)} case "${GOOS}_${GOARCH}" in - linux_amd64) CC=clang ;; + linux_amd64) CC=musl-gcc ;; linux_arm64) CC=aarch64-linux-gnu-gcc ;; linux_arm) CC=arm-linux-gnueabihf-gcc ;; darwin_amd64) CC=/opt/osxcross/target/bin/o64-clang ;;