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

Compile issues when targeting aarch64-apple-darwin (Apple M1) #172

Closed
abowerman opened this issue Nov 20, 2020 · 13 comments
Closed

Compile issues when targeting aarch64-apple-darwin (Apple M1) #172

abowerman opened this issue Nov 20, 2020 · 13 comments
Assignees
Labels
awaiting_confirmation Believed fix, waiting for testing

Comments

@abowerman
Copy link

Seeing a few of these when I try to compile on:

Default host: aarch64-apple-darwin

   Compiling winit v0.22.2
error[E0308]: mismatched types
   --> /Users/andrew/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.22.2/src/platform_impl/macos/util/async.rs:170:55
    |
170 |                 ns_window.setFrame_display_(new_rect, 0);
    |                                                       ^ expected `bool`, found integer

It looks like winit v0.23.0 fixes this rust-windowing/winit#1752

@abowerman abowerman changed the title Compile issues on aarch64 (Apple M1) Compile issues when targeting aarch64-apple-darwin (Apple M1) Nov 20, 2020
@thebracket
Copy link
Collaborator

I'll see if I can get winit updated. Testing this one may be tricky, I don't have access to any Apple M1 devices on which to test.

@thebracket
Copy link
Collaborator

The current head has updated glutin & winit to 0.23. Anyone have an M1 to test this on?

@thebracket thebracket self-assigned this Nov 20, 2020
@thebracket thebracket added the awaiting_confirmation Believed fix, waiting for testing label Nov 20, 2020
@abowerman
Copy link
Author

abowerman commented Nov 20, 2020

Yeah, I'll check it out. If you want to see locally you should be able to target the M1:

rustup target add aarch64-apple-darwin
cargo clean
cargo build --target aarch64-apple-darwin

@thebracket
Copy link
Collaborator

Oh nice, thank you! I'll give that a shot.

@abowerman
Copy link
Author

abowerman commented Nov 20, 2020

And Unfortunately I misunderstood, and this winit fix has made it into master not 0.23.0.

patching in the master branch works:

[patch.crates-io]
winit = { git = "https://github.com/rust-windowing/winit", branch = "master" }

but then I have an issue with glutin:

   Compiling glutin v0.25.1
error[E0432]: unresolved import `winit::platform::desktop`
  --> /Users/andrew/.cargo/registry/src/github.com-1ecc6299db9ec823/glutin-0.25.1/src/platform/mod.rs:33:30
   |
33 |     pub use winit::platform::desktop::*;
   |                              ^^^^^^^ could not find `desktop` in `platform`

Will keep digging, let me know if this is unhelpful. This may be more trouble than it's worth for now.

@thebracket
Copy link
Collaborator

If its in their master, I'll have to wait for winit to publish it - and for Glutin to update to use it. :-(

@thebracket thebracket added blocked_upstream Waiting on a parent crate patch and removed awaiting_confirmation Believed fix, waiting for testing labels Nov 20, 2020
@cjbehm
Copy link

cjbehm commented Jan 17, 2021

I pulled bracket-lib master and updated smallvec (per the open PR) and then updated glutin and winit to current released versions in bracket-terminal/Cargo.toml

glutin = {version = "0.26", optional = true }
winit = { version = "0.24.0" }
...
winit = { version = "0.24.0", features = [ "web-sys" ] }

Tested by pulling the rustrogueliketutorial tutorials and changing the tutorial Cargo.toml files to reference my bracket-lib/rltk. I didn't test all of the tutorials, but I tested chapter 01 and 68 which appeared to work correctly.

@rdamron
Copy link

rdamron commented Feb 8, 2021

Ran into this issue, it seems like winit has fixed the issue but maybe glutin doesn't know they need to update to fix it on M1's.

Either way, I am progressing with the book by compiling with x86 and letting rosetta2 run the app.

cargo run --target x86_64-apple-darwin

@thebracket thebracket added awaiting_confirmation Believed fix, waiting for testing and removed blocked_upstream Waiting on a parent crate patch labels Feb 11, 2021
@thebracket
Copy link
Collaborator

A friend tells me that with the new glutin/winit it works for them. Anyone else mind testing for me, please?

@rdamron
Copy link

rdamron commented Feb 11, 2021

Happy to try, what's the best way to override the versions that ship with bracket-lib? Still new to the Rust toolchain.

@thebracket
Copy link
Collaborator

You should be able to replace the bracket-lib line Cargo.toml with:

[dependencies]
bracket-lib = { git = "https://github.com/thebracket/bracket-lib.git" }

That will download the latest github main, and build from there. It should work - winit is updated to not crash on the M1 chip now.

Thanks!

@rdamron
Copy link

rdamron commented Feb 11, 2021

Works wonderfully now! Thanks for the update to bracket-lib.

@thebracket
Copy link
Collaborator

Awesome, thank you! I'll get this issue closed, and I'm one step closer to shipping the next crate version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting_confirmation Believed fix, waiting for testing
Projects
None yet
Development

No branches or pull requests

4 participants