SagerNet / SagerNet/sing-box

Build fails on Go 1.27.0: relocation target golang.org/x/net/http2.(*Transport).connPool not defined

Open
#4,450 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
38.1k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

Operating system

Linux

System version

Artix Linux (Targeting OpenWrt linux/arm64)

Installation type

Original sing-box Command Line

If you are using a graphical client, please provide the version of the client.

No response

Version
v1.14.0-rc.1 (commit: 8dd67a1e49711ce8a9a884bef60a2139ef36446f)
Description

I ran into a build error when trying to cross-compile the v1.14.0-rc.1 tag using the newly released Go 1.27.0. The build completely fails at the linker stage with an error complaining about a missing relocation target for connPool in http2.(*Transport).

It looks like Go 1.27 (or a bumped golang.org/x/net dependency) changed the internal connPool struct or unexported it in a way that breaks the go:linkname hack used in v2rayhttp.ResetTransport.

Downgrading my environment to the latest Go 1.26 release (1.26.7) fixes the issue immediately, and the binary compiles without a hitch using the exact same build flags.

Reproduction
  1. Ensure Go 1.27.0 is installed.
  2. Clone the repo and check out the release candidate:
  3. git clone --branch v1.14.0-rc.1 --depth 1 https://github.com/SagerNet/sing-box.git
  4. cd sing-box
  5. GOOS=linux GOARCH=arm64 go build -v -trimpath -tags "with_utls,badlinkname,tfogo_checklinkname0" -ldflags "-checklinkname=0 -s -w" -o sing-box ./cmd/sing-box
Logs
# github.com/sagernet/sing-box/cmd/sing-box
github.com/sagernet/sing-box/transport/v2rayhttp.ResetTransport: relocation target golang.org/x/net/http2.(*Transport).connPool not defined
Supporter
Integrity requirements
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by checking the v2rayhttp.ResetTransport entry point and reproduce the failure with the listed GOOS=linux GOARCH=arm64 go build command using Go 1.27.0. Trace how the go:linkname reference to golang.org/x/net/http2.(*Transport).connPool is used; done means the v1.14.0-rc.1 build completes successfully on Go 1.27.0 while retaining the reported Go 1.26 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.