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

Always set -ldflags=-s for darwin #11

Closed
grobie opened this issue Apr 9, 2016 · 3 comments
Closed

Always set -ldflags=-s for darwin #11

grobie opened this issue Apr 9, 2016 · 3 comments

Comments

@grobie
Copy link
Member

grobie commented Apr 9, 2016

# darwin-amd64
rm -rf node_exporter node_exporter-0.12.0.darwin-amd64.tar.gz .build *-stamp
cd /go/src/github.com/prometheus/node_exporter && GO15VENDOREXPERIMENT=1 GOPATH=/go /usr/local/go/bin/go build -ldflags "-X main.Version=0.12.0 -X "github.com/prometheus/node_exporter"/collector.Version=0.12.0 -X "github.com/prometheus/node_exporter"/collector.Revision=dd76a68 -X "github.com/prometheus/node_exporter"/collector.Branch=master" -o node_exporter
# github.com/prometheus/node_exporter
/usr/local/go/pkg/tool/linux_amd64/link: /usr/local/go/pkg/tool/linux_amd64/link: combining dwarf failed: open /tmp/go-link-233789061/go.dwarf: no such file or directory
@grobie grobie added the bug label Apr 9, 2016
@sdurrheimer
Copy link
Contributor

Is actually not a bug in promu. You will need to add the -s ldflag for cross-building node_exporter for darwin in order to get rid of the darwf error. It's the same for alertmanager.
golang/go#11994

@grobie
Copy link
Member Author

grobie commented Apr 9, 2016

It seems the ldflag -s is required. We should always inject it.

@grobie grobie added enhancement and removed bug labels Apr 9, 2016
@grobie
Copy link
Member Author

grobie commented Apr 9, 2016

@grobie grobie changed the title crosscompile for darwin fails Always set -ldflags=-s for darwin Apr 9, 2016
roidelapluie pushed a commit that referenced this issue Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants