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

Packaging: Support using Tools Support Core dylib #1805

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bkhouri
Copy link

@bkhouri bkhouri commented Feb 14, 2025

When Swift Package Manager used the SwiftBuild framework, it eventually caused duplicate Swift Tools Support Core (TSC) duplicate symbols which come from Swift Driver and Swift PM.

Swift PM depends on SwiftBuild, which depends on SwiftDriver, which statically links TSC. Swift PM also has a statically linked dependency on TSC.

The proper solution is to have SwiftDriver and SwiftPM both depend on the TSC dynamic library when SwiftPM depends on the SwiftBuild framework, which is determined by setting the SWIFTPM_SWBUILD_FRAMEWORK environment variable.

Steps:

❯ swift package reset
❯ swift build
❯ ll .build/debug/*.dylib
-rwxr-xr-x  1 bkhouri  staff   9.7M Feb 14 14:25 .build/debug/libSwiftDriverDynamic.dylib

❯ swift package reset
❯ SWIFTPM_SWBUILD_FRAMEWORK=1 swift build
❯ ll .build/debug/*.dylib
-rwxr-xr-x  1 bkhouri  staff   6.7M Feb 14 14:26 .build/debug/libSwiftDriverDynamic.dylib
-rwxr-xr-x  1 bkhouri  staff   3.2M Feb 14 14:26 .build/debug/libSwiftToolsSupport.dylib

rdar://144547608

@bkhouri bkhouri marked this pull request as ready for review February 14, 2025 18:03
@bkhouri bkhouri requested review from CodaFi and artemcm February 14, 2025 18:03
When Swift Package Manager used the SwiftBuild framework, it eventually
caused duplicate Swift Tools Support Core (TSC) duplicate symbols which
come from Swift Driver and Swift PM.

Swift PM depends on SwiftBuild, which depends on SwiftDriver, which
statically links TSC. Swift PM also has a statically linked dependency
on TSC.

The proper solution is to have SwiftDriver and SwiftPM both depend on
the TSC dynamic library when SwiftPM depends on the SwiftBuild framework,
which is determined by setting the SWIFTPM_SWBUILD_FRAMEWORK environment
variable.

rdar://144547608
@bkhouri bkhouri force-pushed the t/main/support_SWIFTPM_SWBUILD_FRAMEWORK_env_var branch from 3d5878a to bd16a1b Compare February 14, 2025 19:27
@bkhouri
Copy link
Author

bkhouri commented Feb 14, 2025

@swift-ci please test

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.

1 participant