How to statically link the swift runtime?

Hello

I can't seems to find documentation on this, is it possible to statically link the swift runtime on windows?

1 Like

No, it is not currently possible to do static linking (of any kind involving Swift) on Windows. There is additional work that needs to be done there to actually support it.

See Enabling Static Linking on Windows - Development / Windows - Swift Forums for additional details.

[quote="RUSshy PrepaidCardStatus"]
Hello

I can't seems to find documentation on this, is it possible to statically link the swift runtime on windows?
[/quote]

I can get a swift command-line tool with or without an external framework working, as long as:

  1. The framework copies the swift libraries into its Frameworks directory (optional)
  2. The command-line tool doesn't generate a build failure trying to copy the swift libraries
  3. The tool runpath is configured with a path containing the swift libraries

To get a Framework to copy the swift libraries, set:

"Embedded Content Contains Swift Code" = Yes

To avoid a build failure when a tool tries to copy the swift libraries into its non-existent Bundle Frameworks directory, set:

"Embedded Content Contains Swift Code" = Yes

To configure a tool's runpath, add one of the following to LD_RUNPATH_SEARCH_PATHS:

A. The swift libraries in the external framework:

@executable_path/PromiseKit.framework/Versions/A/Frameworks

Note that Xcode doesn't symlink Versions/A/Frameworks to Frameworks by default, like it does with Resources, Headers, and Modules.