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

cmd/go: build,install: the option -ldflags "-extldflags=..." doesn't work with multiple flags #6234

Closed
gopherbot opened this issue Aug 23, 2013 · 1 comment

Comments

@gopherbot
Copy link

by capnm9:

hg id
037a28ab0725 tip

see:
https://code.google.com/p/go/source/browse/src/cmd/ld/doc.go#91

Something like
go build -ldflags "-v -linkmode=external -extldflags=-v -static"
or
go build -ldflags "-v -linkmode=external -extldflags=\"-v -static\""
or
go build -ldflags "-v -linkmode=external -extldflags='-v -static'"
or
I'm lost here ...

gives
go/pkg/tool/linux_amd64/6l: unknown flag -static


Calling the "linker" directly works as expected:
  
go tool 6l -o $WORK/assets/test1/_obj/exe/a.out -L $WORK -v -linkmode=external
-extldflags="-v -static" $WORK/assets/test1.a
@ianlancetaylor
Copy link
Contributor

Comment 1:

You need to quote the whole option.
go build -ldflags "-v -linkmode=external '-extldflags=-v -static'"
or
go build -ldflags "-v -linkmode=external \"-extldflags=-v -static\""

Status changed to WorkingAsIntended.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants