Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(release): create static builds for linux amd64 #18805

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, why do you need to set stack-size here, is that related to the issue Adrian fixed where we were blowing out the stacks in Rust code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's how to reset the stack size for musl back to the 8 MB.

binary: influx
- id: influxd
goos:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down