What is the message when it is building on Golang?

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

What is the message when it is building on Golang?

问题

当我在Golang上构建源代码时,我看到了警告信息,但是我找不到关于它的答案。

$ go build --mod=mod -o main main.go
# command-line-arguments
ld: warning: -no_pie is deprecated when targeting new OS versions
  • 规格
    版本:go version go1.18 darwin/amd64
    操作系统:Monterey 12.6
    构建命令:go build --mod=mod -o [二进制文件名] main.go
英文:

When I build source on Golang, I saw the warning message, but I couldn't find answer about it.

$ go build --mod=mod -o main main.go
# command-line-arguments
ld: warning: -no_pie is deprecated when targeting new OS versions
  • specs
    version : go version go1.18 darwin/amd64
    os : Monterey 12.6
    build command : go build --mod=mod -o [binary name] main.go

答案1

得分: 1

这似乎是一个已知的问题。更多信息请参考Github

作为一种解决方法,你可以在go build命令中传递-buildmode=pie标志。

英文:

This seems to be a known issue. See Github for more information.

As a workaround you can pass the -buildmode=pie flag to your go build command.

答案2

得分: 1

从GitHub上的链接中可以看到以下内容:

有几个选项:

- 等待下一个Go 1.19.x和1.18.x的发布,可能在下个月初
- 从主分支构建Go
- 对go build和go test使用-pass -buildmode=pie标志进行解决
- 使用较旧版本的系统链接器
英文:

From GitHub: link

There are a few options:

- wait for the next Go 1.19.x and 1.18.x releases, probably early next month
- build Go from the master branch
- pass -buildmode=pie flag to go build and go test for a workaround
- use older version of the system linker

huangapple
  • 本文由 发表于 2022年9月26日 07:12:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/73848392.html
匿名

发表评论

匿名网友

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

确定