douqi3195 2018-08-08 04:25
浏览 386

使用Golang竞赛检测器生成错误

My software compiles and runs fine but when I add the -race option to check for race conditions it does not build:

GOROOT=C:\Go

GOPATH=<deleted>;D:\Golang

C:\Go\bin\go.exe build -race -o C:\Users\Andrewp\AppData\Local\Temp\___1Race_Detector.exe -gcflags "-N -l" -a <deleted>

# runtime/cgo

gcc_libinit_windows.c: In function 'x_cgo_sys_thread_create':
gcc_libinit_windows.c:56:12: error: implicit declaration of function '_beginthread' [-Werror=implicit-function-declaration]
  thandle = _beginthread(func, 0, arg);
            ^
cc1: all warnings being treated as errors

Compilation finished with exit code 2

Note that it worked previously but I have since upgraded to go version go1.9.2 windows/amd64 (though I don't think that is related). Also have MSYS installed.

Also I am building with GoLand (under Windows 10) but I get the same problem when I build from the command line.

Does anyone have info on how the Go compiler works esp. when using race detector or cgo, so I can track down the cause of this?

Extra info: I can build fine from the terminal using:

go build -race

It seems that the problem is caused by the -a option that GoLand added to the command line since this almost identical command line fails:

go build -race -a .

But this is OK:

go build -a .

  • 写回答

1条回答 默认 最新

  • douyi3833 2019-09-23 12:37
    关注

    Details are in this issue. A workaround is usually to set -vet=off

    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记