Skip to content

Add swift.static_stdlib feature to link Swift runtime statically#1686

Open
mauriciogg wants to merge 7 commits into
bazelbuild:mainfrom
mauriciogg:static_runtime
Open

Add swift.static_stdlib feature to link Swift runtime statically#1686
mauriciogg wants to merge 7 commits into
bazelbuild:mainfrom
mauriciogg:static_runtime

Conversation

@mauriciogg
Copy link
Copy Markdown

TODO(#8) in swift/toolchains/swift_toolchain.bzl.

Introduces SWIFT_FEATURE_STATIC_STDLIB, which, when enabled resolves the standard library and runtime (including swiftrt.o) from the toolchain's lib/swift_static/{os} tree instead of the shared lib/swift/{os} tree and drops the shared-library rpath

TODO(bazelbuild#8) in swift/toolchains/swift_toolchain.bzl.

Introduces SWIFT_FEATURE_STATIC_STDLIB, which, when enabled resolves the standard library
and runtime (including swiftrt.o) from the toolchain's
`lib/swift_static/{os}` tree instead of the shared `lib/swift/{os}`
tree and drops the shared-library rpath
@keith
Copy link
Copy Markdown
Member

keith commented Apr 20, 2026

I'm definitely for this feature, it would be great if you could add a sh_test in the end that verified that some binary was linked statically

mauriciogg and others added 3 commits April 20, 2026 10:37
`native.sh_test` was removed in Bazel 9; load it explicitly from
`@rules_shell//shell:sh_test.bzl` (already a dependency in MODULE.bazel
at rules_shell 0.3.0) so the CI presubmit can load `test/BUILD`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants