-
Notifications
You must be signed in to change notification settings - Fork 62
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
rust-binary-calls-swift-package
example doesn't work on a Linux environment
#107
Comments
I haven't tried swift-bridge on linux so I don't have a lot of experience here. But I'm happy to help get to the bottom of this. Right now we build this example in CI on macOS, so it works there swift-bridge/.github/workflows/test.yml Lines 73 to 74 in e24a115
In your error message I see things like Seems like a bunch of symbols that have nothing to do with Can you try adding Also, are you able to run any of the other examples? |
Thank you for your reply. These are my new trials.
|
Hmm this one requires more research.. Not sure to what extent this is possible on Linux. Maybe it is with the right flags, I don't know yet.
Hmmm something to do with Really the error is |
I also just ran into this issue on Fedora Linux when I wanted to test whether it is feasible (in a future) to use cross platform binary artifacts via SPM (compare swiftlang/swift-package-manager#7035, the referenced PR and this POC implementation using binary library artifacts). I think, at least part of the problem is due to the I am wondering if this bridging-header.h is even really needed? Instead, I guess there could be a C-Target that provides the required external definitions instead and separate Swift targets that hold generated code. I adapted the rust-binary-calls-swift-package example this way so you can see what I mean: https://github.com/terraputix/swift-bridge-rust-calls-swift/tree/main/Sources. |
Seems promising. What are the trade-offs on Apple platforms when using your example approach vs. This will help us understand whether we should guide users towards having platform dependent build process such as using If there aren't any meaningful trade-offs then we can consider recommending one cross-platform friendly approach. |
Let me correct myself: As far as I can tell from this thread, it is mostly about preferences whether to use a dedicated C target or a bridging header when working with SPM packages. I am not sure how that behaves when working directly with I eventually found additional linker flags to that enabled me to compile the rust-binary-calls-swift-package example and run it locally on Fedora. Will try to prepare a PR with a fix. |
Hello.
I'm trying to build a CLI application that is mainly written in Rust and calls some Swift functions, and I'm developing it on a Linux environment.
I tried to run
rust-binary-calls-swift-package
example, but it didn't run with following errors.I'm using WSL2 with Ubuntu and swift-5.6.2-RELEASE-ubuntu20.04.
Do you know how I can make it work? Or, are Linux environments not supported?
Thank you in advance!
The text was updated successfully, but these errors were encountered: