-
Notifications
You must be signed in to change notification settings - Fork 234
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
Symbols from multiple Rust projects can conflict in a shared namespace #1670
Comments
Hey @aringenbach . Did you find a solution for this? Im having this problem right now, were the C methods of Rust are conflicting and being duplicated. |
Hello @goncalo-frade-iohk I currently run a very unsatisfying solution, but it does work: I simply fork |
Thx @aringenbach It's a solution that I didn't thought off. I tried to do some work with the linking but was unsuccessful. |
Hey @aringenbach . I tried your solution but it seems my symbols are not uniffi but rust ones, so I cannot actually rename them. Im totally stuck with this :( duplicate symbol '___rust_foreign_exception' |
Goods news, it looks like prefixed rustbuffer functions are already implemented in scaffolding code, and the prefixed functions are used in foreign language bindings. All thats needed to do is remove For I'm not sure about |
Hey sorry I forgot to update. The error was actually on my side, I forgot that Swift Packages builds libraries by default as static. So adding the Here you can see how I setup the swift package If you need to see it completed package you can run: |
Thats awesome! Big thanks guys. |
Steps to reproduce:
Result:
Some symbols will conflict between the two libraries, namely:
(first one is weird because I thought it wouldn't be exposed)
This is especially dire for the
uniffi_foreign_executor_callback_set
because if the wrong function is called and one of the libraries doesn't implement the foreign executor, it will completely break, even if using the same version of Uniffi.Potential change suggestion:
Generate name for symbols that get exposed in the static library with something like
uniffi_library_name_rustbuffer_...
instead of just a uniffi prefix.Note on megazords frameworks
I know that this could be avoided with setting up in a single library and build everything together at the Rust/Uniffi level, but we can also see the value on avoiding those kind of clashes: if I want to build an application with e.g. Mozilla's application-services plus some other Rust libraries, I don't want to bother re-packaging things that have nothing to do together.
The text was updated successfully, but these errors were encountered: