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

gccgo: go/build.Import(..., "archive/zip") doesn't work #23607

Closed
tamird opened this issue Jan 29, 2018 · 7 comments
Closed

gccgo: go/build.Import(..., "archive/zip") doesn't work #23607

tamird opened this issue Jan 29, 2018 · 7 comments
Milestone

Comments

@tamird
Copy link
Contributor

tamird commented Jan 29, 2018

This seems to affect all standard library packages since sources appear not to be shipped in gccgo.

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

go version go1.10beta2 gccgo (GCC) 8.0.1 20180126 (experimental) linux/amd64

Does this issue reproduce with the latest release?

N/A

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/tduberstein/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/tduberstein/local/go"
GORACE=""
GOROOT="/home/tduberstein/local/gcc/gcc"
GOTMPDIR=""
GOTOOLDIR="/home/tduberstein/local/gcc/gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.1"
GCCGO="/home/tduberstein/local/gcc/gcc/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build113750874=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

cd $(go env GOPATH)/src/github.com/cockroachdb/cockroach
make test PKG=./pkg/cmd/cockroach-oss TESTS=TestNoLinkForbidden

What did you expect to see?

Passing tests.

What did you see instead?

--- FAIL: TestNoLinkForbidden (0.01s)
        build.go:76: cannot find package "archive/zip" in any of:
                        /usr/local/home/tduberstein/go/src/github.com/cockroachdb/cockroach/vendor/archive/zip (vendor tree)
                        /home/tduberstein/local/gcc/gcc/src/archive/zip (from $GOROOT)
                        /usr/local/home/tduberstein/go/src/archive/zip (from $GOPATH)
FAIL
FAIL    github.com/cockroachdb/cockroach/pkg/cmd/cockroach-oss  0.396s
make: *** [test] Error 1
@gopherbot gopherbot added this to the Gccgo milestone Jan 29, 2018
@ianlancetaylor
Copy link
Member

Unfortunately, in general this can not work with gccgo, because, as you say, gccgo does not include sources. I'm open to argument but my inclination is to just close this as unfortunate.

@tamird
Copy link
Contributor Author

tamird commented Jan 29, 2018

Seems worse than unfortunate for go/build to not work for the standard library in gccgo. Is there a workaround?

@ianlancetaylor
Copy link
Member

Try setting the GOROOT environment variable to point to a gc installation, which has the sources.

@tamird
Copy link
Contributor Author

tamird commented Jan 30, 2018

Yeah, that works.

@ianlancetaylor
Copy link
Member

Closing as unfortunate.

@tamird
Copy link
Contributor Author

tamird commented Feb 5, 2018

@ianlancetaylor setting GOROOT to a gc installation doesn't work because some packages are different in gccgo:

cd $GOPATH/src/golang.org/x/sys/unix
go build honnef.co/go/tools/cmd/staticcheck
GOROOT=$(go1.10 go env GOROOT) ./staticcheck 
/home/tduberstein/local/go/src/golang.org/x/sys/unix/gccgo.go:21:2: Entersyscall not declared by package syscall

@ianlancetaylor
Copy link
Member

I believe the state of "closing as unfortunate" is still the correct state for this issue.

@golang golang locked and limited conversation to collaborators Feb 5, 2019
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

3 participants