Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 invalid reference to internal/poll.execIO 的解决方案 #2064

Closed
loafman-kangjun opened this issue Aug 26, 2024 · 3 comments
Closed
Labels
documentation Improvements or additions to documentation from end user An end user is asking a developer to fix their problem for free

Comments

@loafman-kangjun
Copy link

loafman-kangjun commented Aug 26, 2024

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:

  • Windows support is gated behind the build tag tfogo_checklinkname0 when building with Go 1.23 and later.
  • With Go 1.21 and 1.22, tfo-go still provides full Windows support, with or without the build tag.
  • With Go 1.23 and later, when the build tag is not specified, tfo-go only supports listen with TFO on Windows. To get full TFO support on Windows, the build tag tfogo_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 编译均可复现

@nekohasekai nekohasekai added documentation Improvements or additions to documentation from end user An end user is asking a developer to fix their problem for free labels Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation from end user An end user is asking a developer to fix their problem for free
Projects
None yet
Development

No branches or pull requests

4 participants
@nekohasekai @loafman-kangjun and others