关于 invalid reference to internal/poll.execIO 的解决方案 #2064
Labels
documentation
Improvements or additions to documentation
from end user
An end user is asking a developer to fix their problem for free
Operating system
Windows
System version
go1.23.0 windows/amd64
Description
在使用go 1.23.0编译sing-box时,我遇到了一个问题
github.com/sagernet/sing-box/cmd/sing-box
link: github.com/sagernet/tfo-go: invalid reference to internal/poll.execIO
make: *** [makefile:20: build] Error 1
无论是否使用添加标签,我了解到,该问题似乎指向 tfo-go
通过对分叉源的查阅
Windows support with Go 1.23 and later
tfo-go
's Windows support requires extensive usage of//go:linkname
to access Go runtime internals, as there's currently no public API for Windows async IO in the standard library. Unfortunately, the Go team has decided to lock down future uses of linkname, starting with Go 1.23. And our bid to get the linknames we need exempted was partially rejected. Therefore, we had to make the following changes:tfogo_checklinkname0
when building with Go 1.23 and later.tfo-go
still provides full Windows support, with or without the build tag.tfo-go
only supportslisten
with TFO on Windows. To get full TFO support on Windows, the build tagtfogo_checklinkname0
must be specified along with linker flag-checklinkname=0
to disable the linkname check.我发现了该问题的解决方法,你需要添加 -ldflags="-checklinkname=0" 标签
举例:go build -ldflags="-checklinkname=0" ./cmd/sing-box
记录以对任何在go1.23上源码出现问题的人提供帮助
可以作为对文档的补充
Reproduction
克隆commit 9832932
make 或 go 编译均可复现
The text was updated successfully, but these errors were encountered: