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, x/vgo: compilation errors upon building #26541

Closed
dchenk opened this issue Jul 23, 2018 · 17 comments
Closed

cmd/go, x/vgo: compilation errors upon building #26541

dchenk opened this issue Jul 23, 2018 · 17 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@dchenk
Copy link
Contributor

dchenk commented Jul 23, 2018

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

go version go1.11beta2 darwin/amd64

Does this issue reproduce with the latest release?

This is happening with the latest release.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/myusername/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/myusername/OneDrive/gocode"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9x/xp9y18vx58q815_7fp24cf5c0000gn/T/go-build936526924=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I just now upgraded from version go1.11beta1 to go1.11beta2.

I'm trying to build a program using the vgo build command, and I'm getting a bunch of errors and failures after the "go.mod" file is built. It doesn't look like it's something particularly due to the packages being included, since this issue occurs with a couple other packages I tried to build.

What did you expect to see?

A successful build.

What did you see instead?

It looks like a few internal packages are not being compiled correctly. There are a lot of "redeclared in this block" errors.

Here's a copy of the complete output by the vgo build command:

$ vgo build
vgo: creating new go.mod: module github.com/dchenk/go-graph-fb
# runtime/internal/sys
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:8:2: ArchFamily redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:8:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:9:2: BigEndian redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:9:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:10:2: CacheLineSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:10:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:11:2: DefaultPhysPageSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:11:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:12:2: PCQuantum redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:12:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:13:2: Int64Align redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:13:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:14:2: HugePageSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:14:29
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:15:2: MinFrameSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:15:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:18:6: Uintreg redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:18:6
# internal/cpu
/usr/local/go/src/internal/cpu/cpu_x86.go:9:7: CacheLineSize redeclared in this block
	previous declaration at /usr/local/go/src/internal/cpu/cpu_wasm.go:7:23
# runtime/internal/atomic
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:14:6: Load redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:13:24
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:20:6: Loadp redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:19:32
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:26:6: Load64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:25:26
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:32:6: Xadd redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:30:37
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:40:6: Xadd64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:33:39
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:48:6: Xadduintptr redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:36:47
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:56:6: Xchg redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:39:36
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:64:6: Xchg64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:42:38
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:72:6: Xchguintptr redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:45:45
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:80:6: And8 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:48:27
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:80:6: too many errors
@spritelw
Copy link

the same to you, i use docker golang:1.11beta2-stretch

@davecheney
Copy link
Contributor

I just now upgraded from version go1.11beta2 to go1.11beta2.

How did you upgrade from one version to another? It is common to see the class of error you describe if one version of Go is unpacked atop another.

@davecheney davecheney added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jul 23, 2018
@davecheney
Copy link
Contributor

Also, as of 1.11beta2 you don't need to type vgo, that functionality has been moved into the go command.

I recommend, unless you want to use the old vgo fork, to delete, vgo from your $PATH.

@dchenk
Copy link
Contributor Author

dchenk commented Jul 23, 2018

@davecheney I used the standard installer for MacOS from golang.org/dl

Is there thorough, official documentation of the new "go build"?

@davecheney
Copy link
Contributor

davecheney commented Jul 23, 2018 via email

@spritelw
Copy link

I have solved it because the different versions of go runtime are covered by each other

@bcmills
Copy link
Contributor

bcmills commented Jul 23, 2018

I just now upgraded from version go1.11beta2 to go1.11beta2.

That looks like a typo. What version did you upgrade from?

I used the standard installer for MacOS from golang.org/dl

Did you rebuild the vgo binary after upgrading the Go toolchain? The _wasm.go suffix is an implicit build constraint in Go 1.11 but not in Go 1.10, so a vgo built from 1.10 will not work with standard library sources from 1.11beta2.

Did you install the Go toolchain from source, or using the binary installer? (The standalone vgo binary requires a source directory that matches the installed runtime, so if your installed runtime is go1.11beta2 and the source directory is older, that could be the problem.)

@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 23, 2018
@bcmills bcmills added this to the Go1.11 milestone Jul 23, 2018
@dchenk
Copy link
Contributor Author

dchenk commented Jul 23, 2018

@bcmills you're right that was a typo; I fixed it to say I upgraded from go1.11beta1.

I did not rebuilt vgo after upgrading. Any suggestions on how to go about doing that safely?

(I had installed Go using the standard Installer for MacOS at https://golang.org/dl/)

@bcmills
Copy link
Contributor

bcmills commented Jul 23, 2018

I did not rebuilt vgo after upgrading. Any suggestions on how to go about doing that safely?

Honestly, at the moment vgo and go1.11beta2 are pretty much equivalent. I second @davecheney's advice to use the go tool instead.

(The reason you'd want to use vgo at this point is to use module support with an older Go toolchain. If you're already on 1.11beta2 that shouldn't be an issue. After 1.11 is released, it may once again become worthwhile to use vgo to pick up changes in between 1.11 and 1.12, but hopefully those changes won't be particularly urgent to upgrade past.)

@dchenk
Copy link
Contributor Author

dchenk commented Jul 23, 2018

That answers my questions. Thank you all!

@dchenk dchenk closed this as completed Jul 23, 2018
@owais
Copy link

owais commented Jul 26, 2018

I installed go1.11beta2 linux/amd64 on a freshly installed system and faced a similar error. I do have an old GOPATH but the GOROOT (Go's own installation) is fresh. I did not upgrade from an older version of Go.

$ vgo build                                                                         
go: creating new go.mod: module github.com/some/repo
go: copying requirements from Gopkg.lock
# runtime/internal/atomic
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:14:6: Load redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:13:24
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:20:6: Loadp redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:19:32
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:26:6: Load64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:25:26
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:32:6: Xadd redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:30:37
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:40:6: Xadd64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:33:39
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:48:6: Xadduintptr redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:36:47
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:56:6: Xchg redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:39:36
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:64:6: Xchg64 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:42:38
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:72:6: Xchguintptr redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:45:45
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:80:6: And8 redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/atomic/atomic_amd64x.go:48:27
/usr/local/go/src/runtime/internal/atomic/atomic_wasm.go:80:6: too many errors
# runtime/internal/sys
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:8:2: ArchFamily redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:8:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:9:2: BigEndian redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:9:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:10:2: CacheLineSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:10:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:11:2: DefaultPhysPageSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:11:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:12:2: PCQuantum redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:12:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:13:2: Int64Align redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:13:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:14:2: HugePageSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:14:29
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:15:2: MinFrameSize redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:15:24
/usr/local/go/src/runtime/internal/sys/arch_wasm.go:18:6: Uintreg redeclared in this block
	previous declaration at /usr/local/go/src/runtime/internal/sys/arch_amd64.go:18:6
# internal/cpu
/usr/local/go/src/internal/cpu/cpu_x86.go:9:7: CacheLineSize redeclared in this block
	previous declaration at /usr/local/go/src/internal/cpu/cpu_wasm.go:7:23

Also, I don't think go and vgo are the same even in beta2. I tried go build and it simply complains that a dependency is missing while as vgo installs the dependencies and then resuts in the above error.

 go build                                                                         
# github.com/some/repo
./main.go:8:14: undefined: sqs

@owais
Copy link

owais commented Jul 26, 2018

I think I misunderstood the comment about vgo. vgo is of course referring to an old install and lives inside GOPATH.

@davecheney
Copy link
Contributor

davecheney commented Jul 26, 2018 via email

@owais
Copy link

owais commented Jul 26, 2018

Yup. I had old 1.10 binaries left in GOPATH which were not working. Thanks

@nicerobot
Copy link

nicerobot commented Sep 8, 2018

I had this error appear in GoLand after I upgraded Go from 1.10 to 1.11. The problem was resolved when I reinstalled vgo go get -u golang.org/x/vgo using 1.11.

@davecheney
Copy link
Contributor

davecheney commented Sep 9, 2018 via email

@nicerobot
Copy link

GoLand seems to do the right thing when vgo is select with the go1.11 SDK also selected.

@golang golang locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants