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: -x flag does not produce executable output #9052

Closed
davecheney opened this Issue Nov 3, 2014 · 5 comments

Comments

Projects
None yet
6 participants
@davecheney
Copy link
Contributor

davecheney commented Nov 3, 2014

dfc@qnap:~$ go build -x os/user
WORK=/tmp/go-build337667835
mkdir -p $WORK/os/user/_obj/
mkdir -p $WORK/os/
cd /home/dfc/go/src/os/user
CGO_LDFLAGS="-g" "-O2" /home/dfc/go/pkg/tool/linux_arm/cgo -objdir
$WORK/os/user/_obj/ -- -I $WORK/os/user/_obj/ lookup_unix.go
** SNIP *

The key is the assignment to CGO_LDFLAGS should be ="-g -O2", but is
incorrectly '-g", "-O2" which will cause the shell to look for a command,
"-O2"

$ CGO_LDFLAGS="-g" "-O2" /home/dfc/go/pkg/tool/linux_arm/cgo -objdir
$WORK/os/user/_obj/ -- -I $WORK/os/user/_obj/ lookup_unix.go
-bash: -O2: command not found
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Nov 3, 2014

Comment 1:

Labels changed: added repo-main, release-go1.5.

@davecheney davecheney added new labels Nov 3, 2014

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@rsc rsc removed the repo-main label Apr 14, 2015

@rsc rsc changed the title cmd/go: -x flag does not produce reproducible output cmd/go: -x flag does not produce executable output Apr 20, 2015

@rsc

This comment has been minimized.

Copy link
Contributor

rsc commented Jun 8, 2015

go build -x is not about producing an exact shell script. This kind of bug has been filed before (maybe about dist?), but of course it depends on the quoting rules of the shell and more. I'm not terribly inclined to try to shove those rules into cmd/go. If you want to use %q that's fine, but it still won't be shell input.

@rsc rsc modified the milestones: Unplanned, Go1.5 Jun 8, 2015

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 23, 2019

TestExecBuildX seems to verify that the output is, in fact, executable.

Was this issue fixed as part of #21427? If it is still reproducible, is there a small change we can make to TestExecBuildX to detect it?

(CC @hirochachacha)

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Feb 11, 2019

Change https://golang.org/cl/84736 mentions this issue: cmd/go: make -x output commands executable again

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Feb 23, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Feb 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.