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

SwiftFormat on Windows should redistribute swift runtimes that it has been tested with #1775

Open
vinocher-bc opened this issue Jul 25, 2024 · 5 comments

Comments

@vinocher-bc
Copy link

SwiftFormat on Windows currently doesn't redistribute swift runtimes that it has been tested with. This can cause it to break with other versions of swift runtimes installed on a machine. Are there plans to redistribute swift runtimes in the installer?

@nicklockwood
Copy link
Owner

@vinocher-bc since I don't use Windows it's difficult for me to know the right solution here. For Linux we ship the runtime, but it bloats the download to 20MB (zipped). @compnerd was kind enough to set up the Windows pipeline for me, so I'd guess I'd defer to him about whether it makes sense to ship the runtime there too?

@compnerd
Copy link
Contributor

I think that for any platform (basically anything non-Darwin), packaging the runtime is needed as there's no ABI stability. The breakages are not really announced or tracked so you can't guarantee that the tool will work. So while it may bloat the distribution, it's the safest thing.

@tristanlabelle
Copy link
Contributor

This has now been completed @nicklockwood . However it has a problematic side-effect: Installing SwiftFormat will put the SwiftFormat directory in the system %Path%, and that directory now includes Swift runtime dlls. This interferes with an installed Swift toolchain, which whose apps like the swiftc compiler depend on the system %Path% to find a matching Swift runtime. Hence the compiler might now load the runtime that SwiftFormat distributes and crash on launch.

I believe this is a problem that the Swift on Windows installer needs to fix, not SwiftFormat, as it would have happened with any other app distributing the runtime and registering itself in %Path%. However I suggest that SwiftFormat include a visible warning about this situation to not be accusing of breaking the Swift toolchain.

@nicklockwood
Copy link
Owner

@tristanlabelle this pattern of installing the swift runtime in a shared location which can then affect other apps seems problematic. Is there no way to statically include the runtime libraries in the binary like we do on Linux?

@tristanlabelle
Copy link
Contributor

@nicklockwood , I agree it's problematic! We don't support statically linking the Swift runtime, and if we did I believe it would prevent an Swift exe from using a Swift dll. I filed this bug on the Swift for Windows installer so we can move the conversation there: swiftlang/swift-installer-scripts#339 . We'll need to solve this problem for all Swift apps on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants