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

main.x: relocation target main.zero not defined #39859

Closed
xin344 opened this issue Jun 25, 2020 · 2 comments
Closed

main.x: relocation target main.zero not defined #39859

xin344 opened this issue Jun 25, 2020 · 2 comments

Comments

@xin344
Copy link

xin344 commented Jun 25, 2020

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

$ go version
go version go1.14.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env #tested by GO111MODULE on and off, same result
GO111MODULE="off"
GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/goroot"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
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-build589208438=/tmp/go-build -gno-record-gcc-switches"

What did you do?

tar -C /$GOROOT -zxf go1.14.4.linux-amd64.tar.gz

in goroot/go/src/cmd/go/internal/get/vcs.go edit createCmd: []string{"clone -U -- {repo} {dir}"}, to createCmd: []string{"clone --progress -U -- {repo} {dir}"},

in goroot/go/src/cmd/go/internal/work/exec.go add
cmd.Stdout = os.Stdout // 重定向标准输出
cmd.Stderr = os.Stderr // 重定向标准输出
below cmd.Stderr = &buf in runOut

build with goroot/go/src/all.bash

What did you expect to see?

build successfully

What did you see instead?

ok cmd/internal/test2json 0.083s
--- FAIL: TestUnresolved (0.22s)
link_test.go:171: want:
main.x: relocation target zero not defined
main.x: relocation target zero not defined
main.x: relocation target main.zero not defined
got:
main.x: relocation target zero not defined
main.x: relocation target zero not defined
main.x: relocation target main.zero not defined
/root/goroot/go/pkg/tool/linux_amd64/link: exit status 2
FAIL
FAIL cmd/link 5.996s
--- FAIL: TestUndefinedRelocErrors (0.20s)
ld_test.go:72: unexpected error: /root/goroot/go/pkg/tool/linux_amd64/link: exit status 2 (x1)
FAIL
FAIL cmd/link/internal/ld 3.208s
ok cmd/link/internal/sym 0.013s
ok cmd/nm 2.154s
ok cmd/objdump 1.249s
ok cmd/pack 0.729s
ok cmd/trace 0.064s
--- FAIL: TestVet (0.48s)
--- FAIL: TestVet/asm (0.11s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/method (1.59s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/unused (0.11s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/unsafeptr (0.09s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/testingpkg (0.11s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/unmarshal (0.26s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/structtag (0.10s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/shift (0.09s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/rangeloop (0.11s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/nilfunc (0.09s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/lostcancel (0.12s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/print (0.26s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/deadcode (0.11s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/copylock (0.14s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/composite (0.15s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/cgo (0.55s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/buildtag (0.16s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/bool (0.13s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/atomic (0.14s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/assign (0.14s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
--- FAIL: TestVet/httpresponse (1.61s)
vet_test.go:162: error check failed:
Unmatched Errors:
/tmp/vet_test052943840/testvet.exe: exit status 1
FAIL
FAIL cmd/vet 5.978s
FAIL
go tool dist: Failed: exit status 1

@xin344
Copy link
Author

xin344 commented Jun 25, 2020

PS. I just want go get ti show a progress bar, and I am in China but I ran all.bash with
HTTP_PROXY=proxy HTTPS_PROXY=proxy FTP_PROXY=proxy ALL_PROXY=proxy NO_PROXY=localhost,127.0.0.0/8,::1 ./all.bash
and I can run go get package with this successfully.

@ianlancetaylor
Copy link
Contributor

As far as I can tell you are saying that you changed the program and some tests failed. That is not a bug in Go. The tests that failed are expecting particular output, and you are changing that output.

@golang golang locked and limited conversation to collaborators Jun 25, 2021
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