竞争检测器运行时错误

huangapple go评论73阅读模式
英文:

Race detector runtime error

问题

golang竞争检测器崩溃/无法运行。错误输出如下:

$ go test -race
# testmain
runtime.RaceErrors: 重定位目标__tsan_report_count未定义
runtime.RaceErrors: 未定义:"__tsan_report_count"
FAIL	raft/vendor/raft/connectionManager [构建失败]

go是从Ubuntu存储库中新安装的1.8版本。
Go竞争时运行时从apt重新安装。

go env:

GOARCH="amd64"
GOBIN="~/Source/Go--Dev/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="~/Source/Go--Dev"
GORACE=""
GOROOT="/usr/lib/go-1.8"
GOTOOLDIR="/usr/lib/go-1.8/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build905991578=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

提前谢谢!

英文:

The golang race detector is crashing/not running. Error output is:

$ go test -race
# testmain
runtime.RaceErrors: relocation target __tsan_report_count not defined
runtime.RaceErrors: undefined: "__tsan_report_count"
FAIL	raft/vendor/raft/connectionManager [build failed]

go is newly installed 1.8 from Ubuntu repository.
Go race runtime was reinstalled from apt.

go env:

GOARCH="amd64"
GOBIN="~/Source/Go--Dev/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="~/Source/Go--Dev"
GORACE=""
GOROOT="/usr/lib/go-1.8"
GOTOOLDIR="/usr/lib/go-1.8/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build905991578=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

Thank you in advance!

答案1

得分: 2

我遇到了同样的问题。在我的情况下,我使用的是一台新机器,只是还没有安装gcc。在运行sudo apt install gcc之后,一切都正常了。

英文:

I had the same issue. In my case, I was on a new machine and simply did not have gcc installed yet. After sudo apt install gcc everything worked fine.

huangapple
  • 本文由 发表于 2017年6月25日 01:51:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/44739294.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定