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

iOS target #13

Open
Milerius opened this issue Feb 24, 2023 · 2 comments
Open

iOS target #13

Milerius opened this issue Feb 24, 2023 · 2 comments

Comments

@Milerius
Copy link

Milerius commented Feb 24, 2023

Hello

I got the following error when I'm compiling to ios targets:

error[E0412]: cannot find type `TryFromBigIntError` in crate `num_bigint`
   --> /Users/romansztergbaum/.cargo/git/checkouts/tezos-rust-sdk-1c87e5341bf84ccf/8885fac/tezos-core/src/error.rs:38:29
    |
38  |         source: num_bigint::TryFromBigIntError<num_bigint::BigInt>,
    |                             ^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ParseBigIntError`
    |
   ::: /Users/romansztergbaum/.cargo/registry/src/github.com-1ecc6299db9ec823/num-bigint-0.4.3/src/lib.rs:141:1
    |
141 | pub struct ParseBigIntError {
    | --------------------------- similarly named struct `ParseBigIntError` defined here

error[E0412]: cannot find type `TryFromBigIntError` in crate `num_bigint`
   --> /Users/romansztergbaum/.cargo/git/checkouts/tezos-rust-sdk-1c87e5341bf84ccf/8885fac/tezos-core/src/error.rs:41:29
    |
41  |         source: num_bigint::TryFromBigIntError<num_bigint::BigUint>,
    |                             ^^^^^^^^^^^^^^^^^^ help: a struct with a similar name exists: `ParseBigIntError`
    |
   ::: /Users/romansztergbaum/.cargo/registry/src/github.com-1ecc6299db9ec823/num-bigint-0.4.3/src/lib.rs:141:1
    |
141 | pub struct ParseBigIntError {
    | --------------------------- similarly named struct `ParseBigIntError` defined here

error[E0277]: the trait bound `i64: From<BigUint>` is not satisfied
   --> /Users/romansztergbaum/.cargo/git/checkouts/tezos-rust-sdk-1c87e5341bf84ccf/8885fac/tezos-core/src/types/mutez.rs:157:23
    |
157 |         Ok(Self(value.try_into()?))
    |                       ^^^^^^^^ the trait `From<BigUint>` is not implemented for `i64`
    |
    = help: the following other types implement trait `From<T>`:
              <i64 as From<NonZeroI64>>
              <i64 as From<bool>>
              <i64 as From<i16>>
              <i64 as From<i32>>
              <i64 as From<i8>>
              <i64 as From<u16>>
              <i64 as From<u32>>
              <i64 as From<u8>>
    = note: required for `BigUint` to implement `Into<i64>`
    = note: required for `i64` to implement `TryFrom<BigUint>`
    = note: required for `BigUint` to implement `TryInto<i64>`

error[E0277]: `?` couldn't convert the error to `error::Error`
   --> /Users/romansztergbaum/.cargo/git/checkouts/tezos-rust-sdk-1c87e5341bf84ccf/8885fac/tezos-core/src/types/mutez.rs:157:33
    |
157 |         Ok(Self(value.try_into()?))
    |                                 ^ the trait `From<Infallible>` is not implemented for `error::Error`
    |
    = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
    = help: the following other types implement trait `From<T>`:
              <error::Error as From<FromUtf8Error>>
              <error::Error as From<ParseBigIntError>>
              <error::Error as From<ParseIntError>>
              <error::Error as From<String>>
              <error::Error as From<TryFromIntError>>
              <error::Error as From<[type error]>>
              <error::Error as From<bs58::decode::Error>>
    = note: required for `std::result::Result<Mutez, error::Error>` to implement `FromResidual<std::result::Result<Infallible, Infallible>>`

Some errors have detailed explanations: E0277, E0412.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `tezos-core` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `tezos-core` due to 4 previous errors

I need to support macabi for cross-platform, so far it's only supported on nightly:

command used:

cargo +nightly build -Z build-std --target aarch64-apple-ios-macabi --target x86_64-apple-ios-macabi --release
@RomarQ
Copy link
Collaborator

RomarQ commented Feb 26, 2023

Currently, we do not support these targets. num_bigint seems to have some limitations because they focus on performance instead of being more agnostic.

@m-kus has integrated ibig-rs successfully, which seems to fix the compatibility issues you are facing.
Give it a try: baking-bad#1

On our side, we still need to evaluate the ibig-rs migration. Hopefully, we will merge Michael contribution soon.

@m-kus
Copy link
Contributor

m-kus commented Feb 26, 2023

Yes, sorry, I will allocate some time soon to backport all the changes I made.

Regarding the ibig crate specifically, there's a follow-up refactoring changing the underlying representation of Nat and Int (UBig and IBig instead of String) and unification of bigint field types in all crates (especially tezos_rpc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants