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

Use "go:embed" to embed "dht-indexer-rust.so" into go binary #4

Open
weebney opened this issue Aug 23, 2023 · 4 comments
Open

Use "go:embed" to embed "dht-indexer-rust.so" into go binary #4

weebney opened this issue Aug 23, 2023 · 4 comments
Labels

Comments

@weebney
Copy link

weebney commented Aug 23, 2023

Using the package embed to embed "dht-indexer-rust.so" into the binary would prevent having to package the library with the binary as a separate file—this would add minimal complexity to cove but make distribution much easier and cleaner.

@anacrolix
Copy link
Owner

Thank you for the great suggestion! Do you have a use case that can guide my changing this? Do you prefer a single executable? I believe it may be possible to statically link the dht-indexer-rust.so file so that I don't need to copy it out at runtime, which would be the case if it were embedded. I suspect needing to have dht-indexer-rust.so in the working directory can be an issue for Linux users, is that the case for you?

@weebney
Copy link
Author

weebney commented Aug 23, 2023

I'm currently packaging cove for Arch; I'm sure as you know it's the de-facto standard for go programs to be entirely self contained (to cut down on package coupling and make distribution easier) and I think cove would be no exception in benefiting from these perks. It doesn't seem like you use Linux, but the primary use case I can see would be in simplifying the packaging of cove for the various flavors of Linux—not a huge use case I guess, but would help me out and anyone else who packages cove in the future. I can do a PR for this and #5 if you can't be bothered.

I suspect needing to have dht-indexer-rust.so in the working directory can be an issue for Linux users, is that the case for you?

See #5—a bit of a broader issue on Linux than just the library not being in the working directory.

@anacrolix
Copy link
Owner

#5 should be fixed shortly. I think I'll look into statically linking the extension for the longer term.

@anacrolix
Copy link
Owner

Statically linking rust sqlite extensions is non trivial. 😢

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

No branches or pull requests

2 participants