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

Compile UniFFI interfaces defined in sibling libraries #2090

Open
Nickersoft opened this issue May 20, 2024 · 5 comments
Open

Compile UniFFI interfaces defined in sibling libraries #2090

Nickersoft opened this issue May 20, 2024 · 5 comments
Labels
bindings/uniffi uniffi bindings enhancement New feature or request

Comments

@Nickersoft
Copy link

Hey folks,

I'm currently trying to adopt Maturin in my monorepo, which is attempting to use UniFFI to export FFI interfaces for Kotlin and Python from a shared Rust crate (odict). The core library is setup to use FFI, and upon compiling will produce a .py file in the target directory:

CleanShot 2024-05-20 at 14 46 38@2x

However, because Maturin expects you to be building your UniFFI interface from the current project, it's looking for pyodict.py (the Python library/binding where I'm using Maturin).

This file doesn't exist and causes an error:

CleanShot 2024-05-20 at 14 48 10@2x

I'd love it if Maturin would allow you to create wheels from shared FFIs like this, instead of forcing you to keep it all in a single project. I combed the docs but couldn't find a way to do this. Hopefully I'm not missing something.

@Nickersoft Nickersoft added the enhancement New feature or request label May 20, 2024
@messense
Copy link
Member

Unfortunately the generated python file name can only be inferred from cdylib_name config in uniffi.toml so you'd need to change it to odict to match the .py file.

@messense messense closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
@messense messense added the bindings/uniffi uniffi bindings label May 21, 2024
@Nickersoft
Copy link
Author

Hey @messense, thanks for the response. I had a uniffi.toml, but I think I had my config wrong. That said, I just replaced it (python/uniffi.toml) with this:

[bindings.python]
cdylib_name = "odict"

and running Maturin it's still looking for pyodict. Is there something else I need to do?

@messense
Copy link
Member

@messense messense reopened this May 24, 2024
@Nickersoft
Copy link
Author

So I actually tried that, and I believe Rust complains if there are two crates that produce libraries with the same name. Away from my keyboard at the moment, but I can safely say it errored and failed to build when I tried that :/

@Nickersoft
Copy link
Author

@messense Any further suggestions? 🥺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/uniffi uniffi bindings enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants