NiklasEi / bevy_game_template

Template for a Bevy game including CI/CD for web, Windows, Linux, macOS, iOS and Android
https://niklasei.github.io/bevy_game_template/
Creative Commons Zero v1.0 Universal
824 stars 88 forks source link

Building for iOS causes errors #95

Open finnnnnnnnnnnnnnnnn opened 9 months ago

finnnnnnnnnnnnnnnnn commented 9 months ago

When attempting to use this template I get all these errors when building in Xcode.

cargo_ios
could not compile `cfg-if` (lib) due to 2 previous errors

could not compile `pin-project-lite` (lib) due to 9 previous errors

could not compile `bitflags` (lib) due to 3 previous errors

cannot find macro `panic` in this scope

could not compile `rustc-hash` (lib) due to 4 previous errors

cannot find attribute `derive` in this scope

could not compile `parking` (lib) due to 27 previous errors

could not compile `thiserror` (lib) due to 15 previous errors

cannot determine resolution for the macro `vec`

cannot find macro `assert_eq` in this scope

cannot find macro `write` in this scope

cannot find macro `assert` in this scope

could not compile `log` (lib) due to 92 previous errors

cannot find macro `assert_ne` in this scope

cannot find macro `debug_assert` in this scope

cannot determine resolution for the macro `ptr::addr_of`

cannot determine resolution for the macro `ptr::addr_of_mut`

cannot find macro `unreachable` in this scope

could not compile `futures-core` (lib) due to 75 previous errors

cannot find macro `debug_assert_ne` in this scope

cannot find macro `debug_assert_eq` in this scope

could not compile `libc` (lib) due to 3 previous errors

cannot find macro `matches` in this scope

could not compile `mint` (lib) due to 287 previous errors

could not compile `zerocopy` (lib) due to 341 previous errors

cannot find macro `concat` in this scope

could not compile `once_cell` (lib) due to 241 previous errors

could not compile `bytemuck` (lib) due to 459 previous errors

could not compile `ppv-lite86` (lib) due to 747 previous errors

cannot find macro `unimplemented` in this scope

cannot find attribute `test` in this scope

cannot find macro `format_args` in this scope

cannot find macro `stringify` in this scope

could not compile `memchr` (lib) due to 663 previous errors

could not compile `serde` (lib) due to 5115 previous errors

No clue what I've done wrong, I'm very new to Bevy and Rust in general.

NiklasEi commented 9 months ago

Did you follow the bevy example readme to install the rust targets for your phone/emulator?

finnnnnnnnnnnnnnnnn commented 9 months ago

You mean this command?

rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim

I have run this

NiklasEi commented 9 months ago

Yes, that's what I meant.

Could you attach a complete log of a build please?

finnnnnnnnnnnnnnnnn commented 9 months ago

Heres the log: Build mobile_2024-01-02T11-35-54.txt I get the same error when using the bash script as well

NiklasEi commented 9 months ago
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-ios` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-apple-ios`

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

Can you run rustup show in the same directory and check if it lists the ios target?

finnnnnnnnnnnnnnnnn commented 9 months ago

Here's the result of rustup show:

rustup home:  /Users/user/.local/share/rustup

installed targets for active toolchain
--------------------------------------

aarch64-apple-ios
aarch64-apple-ios-sim
x86_64-apple-darwin
x86_64-apple-ios

active toolchain
----------------

stable-x86_64-apple-darwin (default)
rustc 1.73.0 (cc66ad468 2023-10-03)

I've just noticed that the error I'm seeing is

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`

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

Which is different from the x86_64-apple-ios in the first log file, so now I'm really lost, though this difference could be since the first log is from building in Xcode and this is from running the make file?

I'm using an Intel Mac not Apple Silicon if thats important.

NiklasEi commented 9 months ago

I am honestly a bit stumped and can't check on a Mac myself at the moment. The release pipeline on GitHub for iOS is running fine on macOS, not sure what else I could test.

Maybe you could try running the rustc commands directly? https://github.com/NiklasEi/bevy_game_template/blob/d50ecbaa5c4fa92d04e3b0daef3b5e0b06ec89c4/mobile/build_rust_deps.sh#L43