How to Build for iOS Targets When Using Rust (via uniffi) #4448
Unanswered
AndreasLarssons
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @AndreasLarssons, currently, we use build runners with the architecture for which we need to build the project. Currently, we only have wasm-emscripten as a cross-platform target you can build on MacOS or Linux. Unfortunately, we don't have plan to add support for cross-platform compilation of the C++ codebase, but hope the PR I mentioned above will help with this. Please let me know if you have any other questions |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We’re currently building an SDK using Rust with uniffi to expose wallet functionality and shared business logic across platforms. We want to utilize wallet-core as the crypto layer, together with other functions like API requests and database management.
We’ve been able to import the
wallet-core
Rust crate successfully, following the guidance in this discussion.However, we now want to use more of the higher-level APIs — for instance,
HDWallet
and related functionality. When we follow thesamples/rust
approach and target our host platform (macOS), everything works as expected.The issue arises when we attempt to build for a different architecture, such as:
At this point, the linker throws errors about missing symbols or mismatched architectures. Based on our understanding, the root cause is likely that the .a files in the /build/ directory (like libTrustWalletCore.a or libTrezorCrypto.a) are built for the host architecture only by default.
Question:
Is there a supported way to generate the /build/ artifacts for a specific target architecture (e.g., aarch64-apple-ios) so we can use them in a Rust project targeting iOS via cargo build --target?
Any insight into a correct CMake invocation or cross-compilation strategy that produces the right .a files for non-host targets would be greatly appreciated.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions