gox icon indicating copy to clipboard operation
gox copied to clipboard

gox build -ldflags

Open littletwolee opened this issue 7 years ago • 2 comments

Hi guys, I have a problem.I want use -ldflags options to build go package. My shell command is gox -os "linux" -arch amd64 -ldflags="" . But it not work. Can anybody tell me what's wrong with me? Thx a lot

littletwolee avatar Aug 28 '17 08:08 littletwolee

You don't specify what doesn't work, that would've been helpful to answer your question. However I'll try to give some examples that might solve the unspecified problem you're having.

Try either of:

gox -ldflags "-s -w" -osarch="linux/amd64" .

Specifies the architecture, might help you on architecture miss-match

gox -ldflags "-s -w" -os="linux" .

Just an example of how to specify ldflags

gox -ldflags "-s -w" -os="linux" -rebuild .

Try rebuilding the binary, in case of stale pkg weirdness.

Dynom avatar Oct 26 '17 15:10 Dynom

@Dynom thx a lot,i'll retry it.

littletwolee avatar Oct 30 '17 06:10 littletwolee