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: exits with errors when -n used with -gcflags=all=... #29346

Closed
jayconrod opened this issue Dec 19, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@jayconrod
Copy link
Contributor

commented Dec 19, 2018

What version of Go are you using (go version)?

$ go version
go version devel +d0f8a7517a Wed Dec 19 19:47:56 2018 +0000 linux/amd64

Does this issue reproduce with the latest release?

No.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/jayconrod/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/local/google/home/jayconrod/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/google/home/jayconrod/Code/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build201316959=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go build -n -gcflags='all=-N -l' runtime

What did you expect to see?

Full list of commands and exit with status 0.

What did you see instead?

Full output is below. Exit status was 1. The error buried in the output is:

go build runtime/internal/atomic: open $WORK/b005/symabis2: no such file or directory

This is happening because (gcToolchain) symabis calls ioutil.ReadFile on a file produced by the assembler. The assembler is never run because of -n so this fails.

#
# internal/cpu
#

mkdir -p $WORK/b003/
cat >$WORK/b003/go_asm.h << 'EOF' # internal
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/internal/cpu
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b003 -I $WORK/b003/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o $WORK/b003/symabis ./cpu_x86.s
cat >$WORK/b003/importcfg << 'EOF' # internal
# import config
EOF
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/compile -o $WORK/b003/_pkg_.a -trimpath $WORK/b003 -l -p internal/cpu -std -+ -buildid JKhkIbODJF784ATyz9CS/JKhkIbODJF784ATyz9CS -symabis $WORK/b003/symabis -D "" -importcfg $WORK/b003/importcfg -pack -asmhdr $WORK/b003/go_asm.h -c=4 ./cpu.go ./cpu_amd64.go ./cpu_x86.go
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b003 -I $WORK/b003/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b003/cpu_x86.o ./cpu_x86.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/pack r $WORK/b003/_pkg_.a $WORK/b003/cpu_x86.o # internal
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/buildid -w $WORK/b003/_pkg_.a # internal

#
# internal/bytealg
#

mkdir -p $WORK/b002/
cat >$WORK/b002/go_asm.h << 'EOF' # internal
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/internal/bytealg
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o $WORK/b002/symabis ./compare_amd64.s ./count_amd64.s ./equal_amd64.s ./index_amd64.s ./indexbyte_amd64.s
cat >$WORK/b002/importcfg << 'EOF' # internal
# import config
packagefile internal/cpu=$WORK/b003/_pkg_.a
EOF
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/compile -o $WORK/b002/_pkg_.a -trimpath $WORK/b002 -l -p internal/bytealg -std -+ -buildid GyDVKUuOFKC_oKD1KNcB/GyDVKUuOFKC_oKD1KNcB -symabis $WORK/b002/symabis -D "" -importcfg $WORK/b002/importcfg -pack -asmhdr $WORK/b002/go_asm.h -c=4 ./bytealg.go ./compare_native.go ./count_native.go ./equal_native.go ./index_amd64.go ./index_native.go ./indexbyte_native.go
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b002/compare_amd64.o ./compare_amd64.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b002/count_amd64.o ./count_amd64.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b002/equal_amd64.o ./equal_amd64.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b002/index_amd64.o ./index_amd64.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b002 -I $WORK/b002/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -o $WORK/b002/indexbyte_amd64.o ./indexbyte_amd64.s
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/pack r $WORK/b002/_pkg_.a $WORK/b002/compare_amd64.o $WORK/b002/count_amd64.o $WORK/b002/equal_amd64.o $WORK/b002/index_amd64.o $WORK/b002/indexbyte_amd64.o # internal
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/buildid -w $WORK/b002/_pkg_.a # internal

#
# runtime/internal/atomic
#

mkdir -p $WORK/b005/
cat >$WORK/b005/go_asm.h << 'EOF' # internal
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/runtime/internal/atomic
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b005 -I $WORK/b005/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o $WORK/b005/symabis ./asm_amd64.s
cat >$WORK/b005/go_asm.h << 'EOF' # internal
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/sync/atomic
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/asm -trimpath $WORK/b005 -I $WORK/b005/ -I /usr/local/google/home/jayconrod/Code/go/pkg/include -D GOOS_linux -D GOARCH_amd64 -gensymabis -o $WORK/b005/symabis2 ./asm.s
go build runtime/internal/atomic: open $WORK/b005/symabis2: no such file or directory

#
# runtime/internal/sys
#

mkdir -p $WORK/b007/
cat >$WORK/b007/importcfg << 'EOF' # internal
# import config
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/runtime/internal/sys
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/compile -o $WORK/b007/_pkg_.a -trimpath $WORK/b007 -l -p runtime/internal/sys -std -+ -complete -buildid EAiJ4l2s3DBUhV5XyJRy/EAiJ4l2s3DBUhV5XyJRy -D "" -importcfg $WORK/b007/importcfg -pack -c=4 ./arch.go ./arch_amd64.go ./intrinsics.go ./stubs.go ./sys.go ./zgoarch_amd64.go ./zgoos_linux.go ./zversion.go
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/buildid -w $WORK/b007/_pkg_.a # internal

#
# runtime/internal/math
#

mkdir -p $WORK/b006/
cat >$WORK/b006/importcfg << 'EOF' # internal
# import config
packagefile runtime/internal/sys=$WORK/b007/_pkg_.a
EOF
cd /usr/local/google/home/jayconrod/Code/go/src/runtime/internal/math
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/compile -o $WORK/b006/_pkg_.a -trimpath $WORK/b006 -l -p runtime/internal/math -std -+ -complete -buildid fR3oSbLHVSBzsaB1SNaJ/fR3oSbLHVSBzsaB1SNaJ -D "" -importcfg $WORK/b006/importcfg -pack -c=4 ./math.go
/usr/local/google/home/jayconrod/Code/go/pkg/tool/linux_amd64/buildid -w $WORK/b006/_pkg_.a # internal

@jayconrod jayconrod added this to the Go1.12 milestone Dec 19, 2018

@jayconrod jayconrod self-assigned this Dec 19, 2018

@josharian

This comment has been minimized.

Copy link
Contributor

commented Dec 20, 2018

I thought I taught cmd/go to ignore -n for package runtime a few releases ago. I guess perhaps that fix was incomplete.

@jayconrod

This comment has been minimized.

Copy link
Contributor Author

commented Dec 20, 2018

@josharian I think this is a regression; go1.11.4 doesn't have a problem. Should be a simple fix though.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 21, 2018

Change https://golang.org/cl/155480 mentions this issue: cmd/go: fix -n output in runtime/internal/atomic

@gopherbot gopherbot closed this in 0005515 Dec 21, 2018

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.