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: test failures in TestScript/vendor_complex, TestIssue7573 #26567

Closed
rogpeppe opened this issue Jul 24, 2018 · 13 comments

Comments

Projects
None yet
4 participants
@rogpeppe
Copy link
Contributor

commented Jul 24, 2018

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

go1.11beta2
go version devel +c814ac4 Thu Jul 19 21:30:27 2018 +0000 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rog/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rog/src/go"
GOPROXY=""
GORACE=""
GOROOT="/home/rog/go"
GOTMPDIR=""
GOTOOLDIR="/home/rog/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/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-build537615162=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cd src
all.bash

What did you see instead?

go test proxy starting
go test proxy running at GOPROXY=http://127.0.0.1:44579/mod
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/language 14c0d48
go proxy: no archive golang.org/x/text/foo 14c0d48
--- FAIL: TestScript (0.00s)
    --- FAIL: TestScript/vendor_complex (0.49s)
        script_test.go:146: 
            # smoke test for complex build configuration (0.487s)
            > go build -o complex.exe complex
            > [exec:gccgo] go build -compiler=gccgo -o complex.exe complex
            [stderr]
            package complex
            	imports runtime: cannot find package "runtime" in any of:
            	$WORK/gopath/src/complex/vendor/runtime (vendor tree)
            	/home/rog/go/src/runtime (from $GOROOT)
            	$WORK/gopath/src/runtime (from $GOPATH)
            [exit status 1]
            FAIL: testdata/script/vendor_complex.txt:3: unexpected command failure
            
--- FAIL: TestIssue7573 (0.02s)
    go_test.go:2898: running testgo [build -n -compiler gccgo cgoref]
    go_test.go:2898: standard error:
    go_test.go:2898: package cgoref
        	imports runtime: cannot find package "runtime" in any of:
        	/home/rog/go/src/runtime (from $GOROOT)
        	/tmp/gotest836162112/src/runtime (from $GOPATH)
        package cgoref
        	imports syscall: cannot find package "syscall" in any of:
        	/home/rog/go/src/syscall (from $GOROOT)
        	/tmp/gotest836162112/src/syscall (from $GOPATH)
        
    go_test.go:2898: go [build -n -compiler gccgo cgoref] failed unexpectedly in /home/rog/go/src/cmd/go: exit status 1
FAIL
FAIL	cmd/go	112.444s
@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

FWIW I just tried it again after running git clean -xf and saw the same issue (although it only took 94.4s to fail that time).

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 24, 2018

I'm wondering why the linux longtest builder isn't seeing this. cmd/go is currently failing there, but not because of these tests: https://build.golang.org/log/6bad8944b0b76092ef2874ca932c643ccd63ec9e

I ran both locally, and they succeed. The second one is skipped because I don't have gccgo installed, though. Perhaps the first one isn't testing anything either.

/cc @ianlancetaylor

@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

I can also reproduce the issue on current Go tip (08ab820).

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2018

@rogpeppe Which version of gccgo do you have installed?

I can't recreate this myself using tip gccgo. The error cannot find package "runtime" in any of suggests that the function isStandardPackage in go/build/gc.go has returned false for "runtime", although of course "runtime" is a standard package. What is the output of:

  • gccgo -print-search-dirs
  • gccgo -dumpversion
  • gccgo -dumpmachine

?

Somewhere in your gccgo installation there should be a file runtime.gox, possibly two such files if you have both 32-bit and 64-bit libraries installed. What are the full paths of those files?

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Jul 24, 2018

@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

After some investigation, it seems that this is happening because I have an old gccgo binary installed in /usr/bin. If I run go test with a path that doesn't include gccgo, the test passes. Is it right that the go tests should be invoking an arbitrary binary outside of the go installation?

@mvdan

This comment has been minimized.

Copy link
Member

commented Jul 24, 2018

Maybe these tests should be skipped if the gccgo version is too old. This is already done with other third-party programs such as gdb.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2018

It's helpful to have some tests of -compiler=gccgo, and how can we do it other than by running those tests if gccgo is on PATH? There are other tests that run system programs, such as gdb and nm.

What version of gccgo do you have installed?

@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

@ianlancetaylor You should be able to reproduce the issue by running these commands:

docker run --rm -i -t ubuntu:16.04 bash
export DEBIAN_FRONTEND=noninteractive
adduser --disabled-password --gecos "" ubuntu
apt-get -y update < /dev/null
apt-get -y install git gcc curl gccgo < /dev/null
su ubuntu
cd /tmp
curl -sL https://dl.google.com/go/go1.11beta2.linux-amd64.tar.gz | tar -zx
cp -rp go go1.11beta2
export PATH=/tmp/go1.11beta2/bin:$PATH
go version
cd go/src/
./all.bash

Here are the results of running your suggested gccgo commands:

$ gccgo -print-search-dirs
install: /usr/lib/gcc/x86_64-linux-gnu/6/
programs: =/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/bin/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/bin/
libraries: =/usr/lib/gcc/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/6/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib/:/lib/x86_64-linux-gnu/6/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/6/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/6/../../../:/lib/:/usr/lib/
$ gccgo -dumpversion
6.0.0
$ gccgo -dumpmachine
x86_64-linux-gnu

I'm not sure exactly what you mean by "in my gccgo installation". dpkg -L prints this, which doesn't seem to include a .gox file:

% dpkg -L gccgo
/.
/usr
/usr/bin
/usr/share
/usr/share/doc
/usr/share/man
/usr/share/man/man1
/usr/bin/gccgo
/usr/bin/x86_64-linux-gnu-gccgo
/usr/share/doc/gccgo
/usr/share/man/man1/x86_64-linux-gnu-gccgo.1.gz
/usr/share/man/man1/gccgo.1.gz
@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

Credit to @myitcv for the initial version of the docker commands above BTW.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2018

If gccgo works at all, then there must be a runtime.gox file and, for that matter, a libgo.a or libgo.so file, somewhere.

But perhaps gccgo doesn't work at all. Does it?

@rogpeppe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2018

No, it doesn't seem to work at all. I must have done apt-get install gccgo it but never actually tried to use it. I guess the answer to the issue is "don't install gccgo with apt" then.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 24, 2018

With the docker script you provided, gccgo does work, but the go tool does not. The problem is that gccgo is looking in a subdirectory go/6 but gccgo -dumpversion prints 6.0.0. The search path used by the go tool is looking for go/6.0.0 but only go/6 exists. I don't understand why this is; it may possibly be a Ubuntu- or Debian- local patch to GCC. I've asked an Ubuntu GCC maintainer for more information.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Jul 27, 2018

Ubuntu bug filed at https://bugs.launchpad.net/ubuntu/+source/gcc-6/+bug/1783930 .

According to that bug this works with gccgo versions 7 and 8.

Since there doesn't seem to be anything to fix in the Go project, closing this issue.

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.