英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论