Dynamically linking Swift runtime #36
Replies: 1 comment 1 reply
-
Thanks @pmarell for opening the discussion! This would definitely work, but it would require a Swift runtime containing all the GNOME libraries as well which would feel very specific. As mentioned in the Flatpak docs, there are currently only a few runtimes. Maybe creating a base app on top of the GNOME platform might be an easier solution.
As I'm not sure about it, I'll ask in the Flatpak Matrix chat whether someone could take a look at the dicussion. |
Beta Was this translation helpful? Give feedback.
-
In AdwaitaTemplate, I noticed that the binary ends up statically linking the Swift standard library, creating a fairly large binary (60 MB). So if multiple apps were installed this way I think it could get wasteful fairly quickly?
Taking out the
--static-swift-stdlib
flag, I get about 6 MB instead, and runningstrip
on the binary it goes down to about 2 MB (which I'm assuming is now justadwaita-swift
statically linked?)I'm not familiar with Flatpak but it seems to support the concept of runtimes? Do you think it would be feasible to do this with just the Swift runtime libraries for end users? I would imagine one challenge to be ensuring that the path of the linked libraries inside your built binary are correct, and getting that to play well with Flatpak?
I could be wrong - but I did look at the Swift Forums to see if there was much traction around dynamic linking in general, but it seems like there's more of a focus on static linking for Linux as that seems more useful for server-side Swift? But technically dynamic + a separate runtime Flatpak should also be possible, as by default
swift build
appears to dynamically link on Linux?I'm happy to look further into this if you like, but just thought I'd ask if there was anything you could think of that would be a show stopper.
Thanks!
And great project btw - came across this from the Swift.org blog. I liked how setup was straightforward, and the polished tutorials (DocC is nice!)
Beta Was this translation helpful? Give feedback.
All reactions