duan1989643 2017-09-01 23:57
浏览 139
已采纳

转到构建失败:runtime / mstkbar.go:151:10:debug.gcstackbarrieroff未定义

This code compiled OK using prior release of golang (1.8.3) however fails to compile after upgrading to new golang (1.9)

~/src/gopath/src/github.com/scottstensland/infosynth $ go build infosynth.go
# runtime
/usr/local/go/src/runtime/mstkbar.go:151:10: debug.gcstackbarrieroff undefined (type struct { allocfreetrace int32; cgocheck int32; efence int32; gccheckmark int32; gcpacertrace int32; gcshrinkstackoff int32; gcrescanstacks int32; gcstoptheworld int32; gctrace int32; invalidptr int32; sbrk int32; scavenge int32; scheddetail int32; schedtrace int32 } has no field or method gcstackbarrieroff)
/usr/local/go/src/runtime/mstkbar.go:162:24: division by zero
/usr/local/go/src/runtime/mstkbar.go:162:43: invalid expression unsafe.Sizeof(composite literal)
/usr/local/go/src/runtime/mstkbar.go:162:44: undefined: stkbar
/usr/local/go/src/runtime/mstkbar.go:212:4: gp.stkbar undefined (type *g has no field or method stkbar)
/usr/local/go/src/runtime/mstkbar.go:213:15: gp.stkbar undefined (type *g has no field or method stkbar)
/usr/local/go/src/runtime/mstkbar.go:216:23: undefined: stackBarrierPC
/usr/local/go/src/runtime/mstkbar.go:226:28: gp.stkbarPos undefined (type *g has no field or method stkbarPos)
/usr/local/go/src/runtime/mstkbar.go:227:19: gp.stkbarPos undefined (type *g has no field or method stkbarPos)
/usr/local/go/src/runtime/mstkbar.go:248:41: undefined: stkbar
/usr/local/go/src/runtime/mstkbar.go:227:19: too many errors

Any ideas ? Actually, this error happens for any golang version upgrade not just the versions I mentioned here.

PS Also get same errors when issuing : go get -v -t ./...

  • 写回答

2条回答 默认 最新

  • duanping1632 2017-09-01 23:57
    关注

    SOLUTION : you must first delete previous golang install prior to installing new go version

    type go    # issue this to confirm where your go lives
    

    a typical output :

    go is /usr/local/go/bin/go  # delete /usr/local/go not just /usr/local/go/bin/go
    

    so just remove it

    sudo rm -rf /usr/local/go  #  OP's missing step else above errors
    

    before you install new version

    export golang_ver=$(curl https://golang.org/VERSION?m=text 2> /dev/null)
    wget https://storage.googleapis.com/golang/${golang_ver}.linux-amd64.tar.gz
    sudo tar -C /usr/local -xzf ${golang_ver}.linux-amd64.tar.gz
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 MATLAB动图问题
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名