mitchellh / gox

A dead simple, no frills Go cross compile tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gox build -ldflags

littletwolee opened this issue · comments

commented

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

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.

commented

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