tools icon indicating copy to clipboard operation
tools copied to clipboard

The base template does not compile when using Metal (Mac OS)

Open Quetzal2 opened this issue 6 years ago • 6 comments

This is not like #97, because I am not talking about a published version of Amethyst (like v0.13.2). This makes it a bit trickier to solve (can't just add a template in https://github.com/amethyst/tools/tree/master/templates, like https://github.com/amethyst/tools/pull/98).

The issue with Amethyst v0.13.2 (and below)

The actual issue is that amethyst v0.13.2 pulls the metal crate (metal-rs) v0.15.0: amethyst v0.13.2 → amethyst_animation v0.8.1 → amethyst_rendy v0.3.0 → rendy v0.3.2 → rendy-command v0.3.0 → rendy-util v0.3.1 → gfx-backend-metal v0.2.4 → metal v0.15.0 .

However, only metal v0.16.0 compiles, having the msg_send explicit typing fix (previous versions did not have it -> https://github.com/SSheldon/rust-objc/issues/62#issuecomment-381122585 . This raises now a compilation error). Prior versions of metal (and some other libraries) do not compile anymore. This is the commit fixing this issue (after v0.15.0): https://github.com/gfx-rs/metal-rs/commit/032800fe731082ff115a5346b5178d12cfd1bf02#diff-b4aea3e418ccdb71239b96952d9cddb6

Using Amethyst master

This leaves Mac OS users no other choice (that I know of) than to use the current master, which pulls metal v0.16.0, which is great! :)

The only issue is that the v0.12.0 template (v0.12.0 is the current Amethyst version used) is not compatible with current master, which makes sense, since it has not been released yet. These are the simple fixes (one of them will already be introduced for v0.13.2) https://github.com/Quetzal2/tools/commit/6d2f66cc24c33f097f2878874db0bd2672a5119e .

Conclusion

The Mac OS platform has no straight forward way to have an Amethyst base project as of now.

Maybe it's worth waiting for the next release, but at least I wanted to raise awareness of the situation of the metal backend. Basically, earlier versions of those packages don't compile anymore, so it is important to use the latest ones.

Quetzal2 avatar Dec 11 '19 23:12 Quetzal2

I believe downgrading the objc crate to 0.2.6 lets you build the releases on mac os. cargo update -p objc --precise 0.2.6. But I don't have a mac to test this.

The templates should probably include a Cargo.lock file to ensure this sort of breakage doesn't keep happening.

0x6273 avatar Dec 12 '19 00:12 0x6273

That works too. I tested it, and can confirm that this "fixes" the issue. I think that this is a good simple trick to bypass the issue for now, as the next Amethyst release will fix it in a clean way.

Including a Cargo.lock in the templates (at least the current one (v0.12.0)) would be great, since this tool is supposed to be usable by newcomers too, and asking them to do this manually could be tricky, since they could miss the information, following other tutorials, or trying Amethyst out by themselves. Adding it to the Readme could be a way to inform the users. If the new Amethyst release is coming soon, we could also simply add the fix, without communicating about it and use this issue as reference if needed.

Quetzal2 avatar Dec 12 '19 08:12 Quetzal2

What I have done is to use amethyst new, and then update the cargo.Toml to use the latest (0.14 at time of writing), followed by correcting a couple of compile errors in the provided main.rs. So far as I can tell, amethyst_tools only really includes update and new, so this should hopefully work until amethyst_tools is upgraded to use the latest stable release.

hectorgrey avatar Feb 18 '20 00:02 hectorgrey

Can someone confirm if this still happens with the 0.13.2 template? I believe the 0.15.1 release of metal-rs should have fixed this, but I don't have a Mac to test this on.

0x6273 avatar Mar 25 '20 18:03 0x6273

Can someone confirm if this still happens with the 0.13.2 template? I believe the 0.15.1 release of metal-rs should have fixed this, but I don't have a Mac to test this on.

@0x6273 I have updated to the latest version created a new test project with no changes and this compiles/runs fine for me on my mac running Catalina 10.15.3.

Get a nice purple window :)

nickbryan avatar Mar 26 '20 17:03 nickbryan

👋 I'm closing all PRs and Issues since amethyst_tools is being end-of-life'd. Please see this forum post for a place to respond and/or discuss the situation rather than here on the repo.

CleanCut avatar Aug 19 '20 16:08 CleanCut