Skip to content

cmd/go, cmd/cgo: repeatable builds with Clang 3.8 #15405

@EtienneBruines

Description

@EtienneBruines

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +f8fc371 Thu Apr 21 17:04:01 2016 +0000 linux/amd64
    (but GOROOT_BOOTSTRAP is set to an installation of go1.6.2)
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/etiennebruines/workspaces/go"
GORACE=""
GOROOT="/home/etiennebruines/workspaces/go-master"
GOTOOLDIR="/home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build179019630=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

(Tested different versions of `clang` (with different results!), more info down below. )
  1. What did you do?
    Attempted to build master branch of Go (currently HEAD is at 40f1d0c )
    (more specifically: ./all.bash within the src directory)
  2. What did you expect to see?
    No errors.
  3. What did you see instead?
    An error within the tests, namely:
--- FAIL: TestCgoConsistentResults (1.10s)
    go_test.go:244: running testgo [build -o /tmp/gotest260338695/cgotest1 cgotest]
    go_test.go:244: running testgo [build -x -o /tmp/gotest260338695/cgotest2 cgotest]
    go_test.go:263: standard error:
    go_test.go:264: WORK=/tmp/go-build737947577
        mkdir -p $WORK/cgotest/_obj/
        mkdir -p $WORK/
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        CGO_LDFLAGS="-g" "-O2" /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/cgo -objdir $WORK/cgotest/_obj/ -importpath cgotest -- -I $WORK/cgotest/_obj/ m.go
        cd $WORK
        clang-3.8 -fdebug-prefix-map=a=b -c trivial.c
        clang-3.8 -gno-record-gcc-switches -c trivial.c
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/_cgo_main.o -c $WORK/cgotest/_obj/_cgo_main.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/_cgo_export.o -c $WORK/cgotest/_obj/_cgo_export.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/cgotest/_obj/ -g -O2 -o $WORK/cgotest/_obj/m.cgo2.o -c $WORK/cgotest/_obj/m.cgo2.c
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/cgotest/_obj/_cgo_.o $WORK/cgotest/_obj/_cgo_main.o $WORK/cgotest/_obj/_cgo_export.o $WORK/cgotest/_obj/m.cgo2.o -g -O2
        /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/cgo -objdir $WORK/cgotest/_obj/ -dynpackage cgotest -dynimport $WORK/cgotest/_obj/_cgo_.o -dynout $WORK/cgotest/_obj/_cgo_import.go
        cd $WORK
        clang-3.8 -no-pie -c trivial.c
        cd /home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest
        clang-3.8 -I . -fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/cgotest/_obj/_all.o $WORK/cgotest/_obj/_cgo_export.o $WORK/cgotest/_obj/m.cgo2.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
        /home/etiennebruines/workspaces/go-master/pkg/tool/linux_amd64/compile -o $WORK/cgotest.a -trimpath $WORK -p cgotest -buildid 1491fc40a2d4f2376923084c60120b2fd293fe0e -D _/home/etiennebruines/workspaces/go-master/src/cmd/go/testdata/src/cgotest -I $WORK -pack $WORK/cgotest/_obj/_cgo_gotypes.go $WORK/cgotest/_obj/m.cgo1.go $WORK/cgotest/_obj/_cgo_import.go
        pack r $WORK/cgotest.a $WORK/cgotest/_obj/_all.o # internal
        mkdir -p /tmp/gotest260338695/
        mv $WORK/cgotest.a /tmp/gotest260338695/cgotest2

    go_test.go:2775: building cgotest twice did not produce the same output
FAIL
FAIL    cmd/go  29.068s

Notes

When running CGO_ENABLED=0, all errors go away (makes sense).

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions