actions-rust-lang / setup-rust-toolchain

Setup a specific Rust toolchain with extra features like problem matchers
MIT License
196 stars 33 forks source link

Error: std, format not found #35

Closed paulocoutinhox closed 10 months ago

paulocoutinhox commented 10 months ago

Hi,

Im using this action, but when i will compile, i get these errors:

make
  shell: /usr/local/bin/bash -e {0}
  env:
    CARGO_INCREMENTAL: 0
    CARGO_PROFILE_DEV_DEBUG: 0
    CARGO_TERM_COLOR: always
    RUST_BACKTRACE: short
    RUSTFLAGS: -D warnings
    CARGO_UNSTABLE_SPARSE_REGISTRY: true
    CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
    CACHE_ON_FAILURE: false
cargo build --release --target=aarch64-apple-ios --manifest-path=src/Cargo.toml
   Compiling your_project v1.0.0 (/Users/runner/work/rust-mobile-sample/rust-mobile-sample/src)
error[E046[3](https://github.com/paulocoutinhox/rust-mobile-sample/actions/runs/7524975825/job/20480590595#step:5:3)]: can't find crate for `std`
  |
  = note: the `aarch6[4](https://github.com/paulocoutinhox/rust-mobile-sample/actions/runs/7524975825/job/20480590595#step:5:4)-apple-ios` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios`

error: cannot find macro `format` in this scope
Error:   --> lib.rs:13:20
   |
13 |     let greeting = format!("Hello {}", name_str);
   |                    ^^^^^^

error[E0[5](https://github.com/paulocoutinhox/rust-mobile-sample/actions/runs/7524975825/job/20480590595#step:5:5)31]: cannot find tuple struct or tuple variant `Err` in this scope
Error:  --> lib.rs:9:9
  |
9 |         Err(_) => "ERROR",
  |         ^^^ not found in this scope

error[E0531]: cannot find tuple struct or tuple variant `Ok` in this scope
Error:   --> lib.rs:10:9
   |
10 |         Ok(string) => string,
   |         ^^ not found in this scope

error: requires `sized` lang_item

Some errors have detailed explanations: E04[6](https://github.com/paulocoutinhox/rust-mobile-sample/actions/runs/7524975825/job/20480590595#step:5:6)3, E0531.
For more information about an error, try `rustc --explain E0463`.
error: could not compile `your_project` (lib) due to 5 previous errors
make: *** [target/ios/aarch64-apple-ios] Error [10](https://github.com/paulocoutinhox/rust-mobile-sample/actions/runs/7524975825/job/20480590595#step:5:10)1
Error: Process completed with exit code 2.

Can you help me?

Thanks.

robjtede commented 10 months ago

please show your entire action step config

jonasbb commented 10 months ago

I think you are installing the wrong target with the action. The error message hints at it:

error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-apple-ios` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios`

Installed is this toolchain:

info: override toolchain for '/Users/runner/work/rust-mobile-sample/rust-mobile-sample' set to 'stable-x86_64-apple-darwin'

  stable-x86_64-apple-darwin unchanged - rustc 1.75.0 (82e1608df 2023-12-21)

Try writing this in your CI script:

- uses: actions-rust-lang/setup-rust-toolchain@v1
  with:
    target: aarch64-apple-ios