bazelbuild / bazelbuild/rules_swift

Support fully-static linking

Open
#8 7 comments 2 reactions 0 assignees View on GitHub
P3 type: feature request
Dominant language
Starlark
Stars
353
Forks
172
Avg merge
23h 14m
Merged PRs (30d)
8

Description

Right now, we only support kind-of-static linking: the `swift_library` targets that the binary depends on are statically linked into the final binary, but the Swift runtime libraries are dynamically linked. This is fine (and in fact, desired) on Apple's mobile platforms (iOS, tvOS, watchOS), but on Linux (and probably macOS), we should offer static linking against the runtime as well.

One interesting catch: Linux toolchains do not come with a static version of `libdispatch`, which would seem to mean you can't do a whole lot of interesting stuff in a statically linked environment. So this might reduce the usefulness and urgency of this feature.

Contributor guide

Open the contributing guide

Research direction

Start by examining how swift_library targets are linked into the final binary and how the Swift runtime libraries are selected for Linux and macOS toolchains. Check the availability of static libdispatch on Linux, then determine what toolchain and platform behavior would need to change for runtime-static linking to work. Done means a supported static-linking path is defined without breaking the existing Apple mobile behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.