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

Statically linked Linux platform for plugins #2961

Open
itowlson opened this issue Dec 16, 2024 · 2 comments
Open

Statically linked Linux platform for plugins #2961

itowlson opened this issue Dec 16, 2024 · 2 comments

Comments

@itowlson
Copy link
Contributor

At the moment plugins are distinguished only as Linux/Mac/Windows and x64/ARM.

Because of this, the static-linux build of Spin resolves to Linux and typically ends up trying to load dynamically linked plugins, which doesn't end well.

One proposal is that we should support a new "static Linux" OS type for plugins. Some careful timing would be needed here, because existing versions of Spin will be unable to parse a new OS string, and would likely end up failing to load the manifest altogether. And of course we can't make them more forgiving because they're already out there.

Another possible way is to add a new optional field to PluginPackage e.g. "linkage" or something more general. I believe (but haven't yet confirmed) that existing Spin is wisely tolerant of unknown fields in a plugin manifest. Statically linked builds could then take this into account.

We would also need a way for a Spin instance to determine if it should use the static plugin. But if we can't determine this dynamically then we can just inject an indicator at compile time.

A final possibility is to do nothing in Spin but to encourage plugin authors to link their Linux builds statically. Although this depends on my naive assumption that static builds can run anywhere that dynamic ones can. Come at me, vengeful hubris, I am ready for your scorn.

@itowlson
Copy link
Contributor Author

cc @jandubois for visibility

@lann
Copy link
Collaborator

lann commented Dec 17, 2024

I don't know that there is a standard label for statically linked artifacts. The rust equivalent is target-feature=+crt-static; by analogy we could have a set of "target features" on each PluginPackage (default empty) and have statically-linked spins "prefer" packages marked as statically linked while dynamically-linked spins "prefer" packages without that feature, and encourage plugin maintainers to publish both for Linux. Seems somewhat unavoidably messy...

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

No branches or pull requests

2 participants