You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
release: Unify default build tags and linker flags into shared files
Move hardcoded build tags and ldflags from Makefile, Dockerfile, CI
workflows, and local build scripts into canonical files under release/:
- release/DEFAULT_BUILD_TAGS (Linux common archs, Darwin, Android)
- release/DEFAULT_BUILD_TAGS_WINDOWS (includes with_purego)
- release/DEFAULT_BUILD_TAGS_OTHERS (no with_naive_outbound)
- release/LDFLAGS (shared linker flags)
Copy file name to clipboardExpand all lines: docs/installation/build-from-source.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,11 +57,35 @@ go build -tags "tag_a tag_b" ./cmd/sing-box
57
57
|`with_v2ray_api`| :material-close:️ | Build with V2Ray API support, see [Experimental](/configuration/experimental#v2ray-api-fields). |
58
58
|`with_gvisor`| :material-check: | Build with gVisor support, see [Tun inbound](/configuration/inbound/tun#stack) and [WireGuard outbound](/configuration/outbound/wireguard#system_interface). |
59
59
|`with_embedded_tor` (CGO required) | :material-close:️ | Build with embedded Tor support, see [Tor outbound](/configuration/outbound/tor/). |
60
-
|`with_tailscale`| :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale)|
61
-
|`with_naive_outbound`| :material-close:️ | Build with NaiveProxy outbound support, see [NaiveProxy outbound](/configuration/outbound/naive/). |
60
+
|`with_tailscale`| :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale). |
61
+
|`with_ccm`| :material-check: | Build with Claude Code Multiplexer service support. |
62
+
|`with_ocm`| :material-check: | Build with OpenAI Codex Multiplexer service support. |
63
+
|`with_naive_outbound`| :material-check: | Build with NaiveProxy outbound support, see [NaiveProxy outbound](/configuration/outbound/naive/). |
64
+
|`badlinkname`| :material-check: | Enable `go:linkname` access to internal standard library functions. Required because the Go standard library does not expose many low-level APIs needed by this project, and reimplementing them externally is impractical. Used for kTLS (kernel TLS offload) and raw TLS record manipulation. |
65
+
|`tfogo_checklinkname0`| :material-check: | Companion to `badlinkname`. Go 1.23+ enforces `go:linkname` restrictions via the linker; this tag signals the build uses `-checklinkname=0` to bypass that enforcement. |
62
66
63
67
It is not recommended to change the default build tag list unless you really know what you are adding.
64
68
69
+
## :material-wrench: Linker Flags
70
+
71
+
The following `-ldflags` are used in official builds:
|`-X 'internal/godebug.defaultGODEBUG=multipathtcp=0'`| Go 1.24 enabled Multipath TCP for listeners by default (`multipathtcp=2`). This may cause errors on low-level sockets, and sing-box has its own MPTCP control (`tcp_multi_path` option). This flag disables the Go default. |
76
+
|`-checklinkname=0`| Go 1.23+ linker rejects unauthorized `go:linkname` usage. This flag disables the check, required together with the `badlinkname` build tag. |
77
+
78
+
## :material-package-variant: For Downstream Packagers
79
+
80
+
The default build tag lists and linker flags are available as files in the repository for downstream packagers to reference directly:
81
+
82
+
| File | Description |
83
+
|------|-------------|
84
+
|`release/DEFAULT_BUILD_TAGS`| Default for Linux (common architectures), Darwin, and Android. |
85
+
|`release/DEFAULT_BUILD_TAGS_WINDOWS`| Default for Windows (includes `with_purego`). |
86
+
|`release/DEFAULT_BUILD_TAGS_OTHERS`| Default for other platforms (no `with_naive_outbound`). |
87
+
|`release/LDFLAGS`| Required linker flags (see above). |
88
+
65
89
## :material-layers: with_naive_outbound
66
90
67
91
NaiveProxy outbound requires special build configurations depending on your target platform.
0 commit comments