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
Closed

cmd/go: test failures in TestScript/vendor_complex, TestIssue7573 #26567

rogpeppe opened this issue Jul 24, 2018 · 13 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@rogpeppe
Copy link
Contributor

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
Copy link
Contributor Author

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).

@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure. labels Jul 24, 2018
@mvdan
Copy link
Member

mvdan 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
Copy link
Contributor Author

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

@ianlancetaylor
Copy link
Contributor

@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
Copy link
Contributor Author

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
Copy link
Member

mvdan 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
Copy link
Contributor

ianlancetaylor 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
Copy link
Contributor Author

@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
Copy link
Contributor Author

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

@ianlancetaylor
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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.

@golang golang locked and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

5 participants