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: git tip fails to pass all.bash's build-time tests on Fedora 27 from commit afd090c0 #23337

Closed
siebenmann opened this issue Jan 4, 2018 · 1 comment

Comments

@siebenmann
Copy link

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

go version devel +7c2cf4e779 Thu Jan 4 18:01:55 2018 +0000 linux/amd64

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

GOARCH="amd64"
GOOS="linux"

Specifically I'm on Fedora 27, which has gcc gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2).

What did you do?

Running ./all.bash now fails during the tests, with the following error output (which is rather verbose):

ok      cmd/fix 0.047s
--- FAIL: TestExecBuildX (0.35s)
        go_test.go:4781: running testgo [build -x -o /tmpfs/gotest859517246/main /tmpfs/gotest859517246/main.go]
        go_test.go:4781: standard error:
        go_test.go:4781: WORK=/tmpfs/go-build188593090
                mkdir -p $WORK/b001/
                cd /tmpfs/gotest859517246
                CGO_LDFLAGS='"-g" "-O2"' /tmp/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b001/ -importpath command-line-arguments -- -I $WORK/b001/ -g -O2 ./main.go
                cd $WORK
                gcc -fno-caret-diagnostics -c -x c -
                gcc -Qunused-arguments -c -x c -
                gcc -fdebug-prefix-map=a=b -c -x c -
                gcc -gno-record-gcc-switches -c -x c -
                cd $WORK/b001
                gcc -I /tmpfs/gotest859517246 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x001.o -c _cgo_export.c
                gcc -I /tmpfs/gotest859517246 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x002.o -c main.cgo2.c
                gcc -I /tmpfs/gotest859517246 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_cgo_main.o -c _cgo_main.c
                cd /tmpfs/gotest859517246
                gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b001=/tmp/go-build -gno-record-gcc-switches -o $WORK/b001/_cgo_.o $WORK/b001/_cgo_main.o $WORK/b001/_x001.o $WORK/b001/_x002.o -g -O2
                /tmp/go/pkg/tool/linux_amd64/cgo -dynpackage main -dynimport $WORK/b001/_cgo_.o -dynout $WORK/b001/_cgo_import.go
                cat >$WORK/b001/importcfg << 'EOF' # internal
                packagefile runtime/cgo=/tmp/go/pkg/linux_amd64/runtime/cgo.a
                packagefile syscall=/tmp/go/pkg/linux_amd64/syscall.a
                packagefile runtime=/tmp/go/pkg/linux_amd64/runtime.a
                EOF
                /tmp/go/pkg/tool/linux_amd64/compile -o $WORK/b001/_pkg_.a -trimpath $WORK/b001 -p main -buildid M4lDtxFv4hjaiV5AQiZY/M4lDtxFv4hjaiV5AQiZY -D _/tmpfs/gotest859517246 -importcfg $WORK/b001/importcfg -pack -c=4 $WORK/b001/_cgo_gotypes.go $WORK/b001/main.cgo1.go $WORK/b001/_cgo_import.go
                /tmp/go/pkg/tool/linux_amd64/pack r $WORK/b001/_pkg_.a $WORK/b001/_x001.o $WORK/b001/_x002.o # internal
                /tmp/go/pkg/tool/linux_amd64/buildid -w $WORK/b001/_pkg_.a # internal
                cat >$WORK/b001/importcfg.link << 'EOF' # internal
                packagefile command-line-arguments=$WORK/b001/_pkg_.a
                packagefile runtime/cgo=/tmp/go/pkg/linux_amd64/runtime/cgo.a
                packagefile syscall=/tmp/go/pkg/linux_amd64/syscall.a
                packagefile runtime=/tmp/go/pkg/linux_amd64/runtime.a
                packagefile internal/race=/tmp/go/pkg/linux_amd64/internal/race.a
                packagefile sync=/tmp/go/pkg/linux_amd64/sync.a
                packagefile runtime/internal/atomic=/tmp/go/pkg/linux_amd64/runtime/internal/atomic.a
                packagefile runtime/internal/sys=/tmp/go/pkg/linux_amd64/runtime/internal/sys.a
                packagefile sync/atomic=/tmp/go/pkg/linux_amd64/sync/atomic.a
                EOF
                mkdir -p $WORK/b001/exe/
                cd .
                /tmp/go/pkg/tool/linux_amd64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -buildmode=exe -buildid=9ybITGoHf3QStg7Y91xk/M4lDtxFv4hjaiV5AQiZY/R_7aLp5sp2RBCRb7ODNh/9ybITGoHf3QStg7Y91xk -extld=gcc $WORK/b001/_pkg_.a
                /tmp/go/pkg/tool/linux_amd64/buildid -w $WORK/b001/exe/a.out # internal
                mkdir -p /tmpfs/gotest859517246/
                mv $WORK/b001/exe/a.out /tmpfs/gotest859517246/main
                rm -r $WORK/b001/

        go_test.go:4803: /bin/sh /tmpfs/gotest859517246/test.sh: exit status 1
                + set -e
                + WORK=/tmpfs/go-build188593090
                + mkdir -p /tmpfs/go-build188593090/b001/
                + cd /tmpfs/gotest859517246
                + CGO_LDFLAGS='"-g" "-O2"'
                + /tmp/go/pkg/tool/linux_amd64/cgo -objdir /tmpfs/go-build188593090/b001/ -importpath command-line-arguments -- -I /tmpfs/go-build188593090/b001/ -g -O2 ./main.go
                + cd /tmpfs/go-build188593090
                + gcc -fno-caret-diagnostics -c -x c -
                gcc: error: unrecognized command line option ‘-fno-caret-diagnostics’; did you mean ‘-fno-cprop-registers’?
FAIL

The specific failure is introduced in commit afd090c, which changed cmd/go/go_test.go's TestExecBuildX test to use set -e as part of the generated test.sh script. The core problem is that the generated script includes gcc probes from cmd/go/internal/work/exec.go's gccSupportsFlag() method that are designed to see if the installed gcc supports certain options. Should any of these flags not be supported the gcc command being run will fail, which set -e turns into a failure of the entire test.sh script and thus the test. It seems likely that the real problem is that these gcc flag-support probe commands are being included in the script at all.

(This close to Go 1.10, the best short term fix might be to not use set -e in TestExecBuildX.)

@gopherbot
Copy link

Change https://golang.org/cl/86239 mentions this issue: cmd/go: fix build failure in -x test

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