golang中未定义type.runtime.g。

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

golang type.runtime.g not defined

问题

当我使用以下代码构建我的Golang项目时:

go build -tags static_all -v -o bin/output ./pkg/main/main.go

我得到了以下结果:

github.com/timandy/routine/g.getg0: 重定位目标 type.runtime.g 未定义

github.com/timandy/routine 的版本是 v1.0.8,而文件 github.com/timandy/routine/g.go 似乎与 type.runtime.g 没有任何关联,除了注释之外。

我不知道如何解决这个问题...

英文:

when i build my golang project by this code:

go build -tags static_all -v -o bin/output ./pkg/main/main.go

i got the result:

github.com/timandy/routine/g.getg0: relocation target type.runtime.g not defined

the version of github.com/timandy/routine is v1.0.8, and the file github.com/timandy/routine/g.go don't seem to have anything to do with type.runtime.g except that annotation

i dont know how to solve it...

答案1

得分: 1

这在timandy/routine issue 24中提到,假设你正在使用Go 1.20进行编译,这是由于其链接器

考虑到该问题的最后一条评论(2023年2月)是:

> 现在routine的最新版本支持go1.20。

你应该将routine的依赖升级到1.1.1版本。


或者,由于原帖中使用的是Go 1.18,升级到Go 1.20/1.21就足够了。

英文:

This is mentioned in timandy/routine issue 24, assuming you are compiling with Go 1.20, due to its linker.

Considering the last comment (Feb. 2023) on that issue is:

> Now the latest version of routine supports go1.20.

You should upgrade your routine dependency to version 1.1.1.


Alternatively, since the OP was using Go 1.18, upgrading to Go 1.20/1.21 was enough.

huangapple
  • 本文由 发表于 2023年7月25日 01:43:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76756884.html
匿名

发表评论

匿名网友

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

确定