Stronghold v1.0.4 doesn't cross-compile rust targets for mobile devices
Closed this issue · 1 comments
Bug description
Dear Strongholders,
first, I highly appreciate your work and contribution to IOTA. Thank you for that!
I would like to draw your attention to one thing related to Android and iOS. I made an A/B comparison between Stronghold versions v0.4.1 and v1.0.4.
Why v0.4.1 ? Well, the iota-wallet used in Firefly (branch "develop" = Shimmer Version) uses the iota_stronghold v0.4.1 dependency.
https://github.com/iotaledger/firefly/blob/develop/packages/backend/Cargo.toml
iota-wallet = { git = "https://github.com/iotaledger/wallet.rs", rev = "f21eb3ced89d90ea77e4797e32c0ddc22577687b", default-features = false, features = ["stronghold", "ledger-nano", "ledger-nano-simulator", "participation"] }
https://github.com/iotaledger/firefly/blob/develop/packages/backend/Cargo.lock
[[package]]
name = "iota_stronghold"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e670d2cfc025f33356e7a113456bd68a731217cc51b0e67d7d36986e1114bec2"
dependencies = [
"anyhow",
"bincode",
"futures",
"iota-crypto 0.5.1",
"riker",
"serde 1.0.136",
"stronghold-utils",
"stronghold_engine",
"thiserror",
"zeroize",
"zeroize_derive",
]
The good news: The library can be compiled for iOS and Android when it includes v0.4.1.
The bad news: However, when I try the same for the latest Stronghold version v1.0.4, it fails.
Rust version
Which version of Rust are you running?
> rustc --version
rustc 1.64.0 (a55dd71d5 2022-09-19)
> rustup show
Default host: x86_64-apple-darwin
installed toolchains
--------------------
stable-aarch64-apple-darwin
stable-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
installed targets for active toolchain
--------------------------------------
aarch64-apple-darwin
aarch64-apple-ios
aarch64-apple-ios-sim
aarch64-linux-android
arm-linux-androideabi
armv7-linux-androideabi
i686-linux-android
x86_64-apple-darwin
x86_64-apple-ios
x86_64-linux-android
active toolchain
----------------
stable-x86_64-apple-darwin (default)
rustc 1.64.0 (a55dd71d5 2022-09-19)
Stronghold version
Which version of Stronghold are you using?
v0.4.1: https://github.com/iotaledger/stronghold.rs/tree/iota-stronghold-v0.4.1
v1.0.4: https://github.com/iotaledger/stronghold.rs/releases/tag/iota-stronghold-v1.0.4
Hardware specification
What hardware are you using?
- Operating system: macOS Monterey (12.6)
- RAM: 8GB
- Cores: 8
- Device: MacBookAir10,1
Steps To reproduce the bug
The steps for the A/B comparison are the same. For case A use v0.4.1, for case B use v1.0.4
- Download the Stronghold version (A or B) mentioned above
- cd client
- Test iOS (I tried only one target):
cargo build --target aarch64-apple-ios
- Test Android (I am using cargo-ndk https://github.com/bbqsrc/cargo-ndk, could be that you also need to install Android NDK - I use v22.1 - NDK API level: 21):
cargo ndk -t arm64-v8a build
Expected behaviour
I expect that the latest Stronghold version B would compile. IMHO this will also enable the Wallet resp. Firefly team to switch to Stronghold v1.0.4 in the future.
Actual behaviour
Currently, the older release version v0.4.1 cross-compiles both targets for iOS/Android.
The latest release v1.0.4 comes up with the error shown below:
Errors
Compiling stronghold-runtime v1.0.1 (/stronghold.rs-iota-stronghold-v1.0.4/engine/runtime)
error[E0046]: not all trait items implemented, missing: `alloc`, `dealloc`
--> engine/runtime/src/memories/frag.rs:203:1
|
50 | fn alloc(config: Option<FragConfig>) -> Result<Frag<T>, Self::Error>;
| --------------------------------------------------------------------- `alloc` from trait
...
53 | fn dealloc(frag: &mut Frag<T>) -> Result<(), Self::Error>;
| ---------------------------------------------------------- `dealloc` from trait
...
203 | impl<T> Alloc<T> for MemoryMapAlloc
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `alloc`, `dealloc` in implementation
error[E0046]: not all trait items implemented, missing: `alloc`, `dealloc`
--> engine/runtime/src/memories/frag.rs:358:1
|
50 | fn alloc(config: Option<FragConfig>) -> Result<Frag<T>, Self::Error>;
| --------------------------------------------------------------------- `alloc` from trait
...
53 | fn dealloc(frag: &mut Frag<T>) -> Result<(), Self::Error>;
| ---------------------------------------------------------- `dealloc` from trait
...
358 | impl<T> Alloc<T> for DirectAlloc
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `alloc`, `dealloc` in implementation
For more information about this error, try `rustc --explain E0046`.
error: could not compile `stronghold-runtime` due to 2 previous errors
Maybe, because only target_os "linux", "windows" and "macos" are implemented in frag.rs? I am new to Rust, so you'll know better.
Get same issue