sunjay / turtle

Create Animated Drawings in Rust
http://turtle.rs
Mozilla Public License 2.0
559 stars 54 forks source link

Turtle does not compile on mac #241

Closed ssempervirens closed 2 years ago

ssempervirens commented 3 years ago

I tried to add turtle to my project by adding turtle = "1.0.0-rc.3". When I ran cargo build, I get a compile error which looks to be an issue of one of turtle's dependencies, winit v0.19.5. This might be a mac specific issue of some kind? I am on a M1 macbook, Big Sur version 11.2.3. Here's the mess of error I get. Thanks for any help resolving this, and thanks again for your work maintaining this project!

   --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/view.rs:209:9
    |
205 | extern fn has_marked_text(this: &Object, _sel: Sel) -> BOOL {
    |                                                        ---- expected `bool` because of return type
...
209 |         (marked_text.length() > 0) as i8
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `i8`

error[E0308]: mismatched types
   --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:103:26
    |
103 |             is_zoomed != 0
    |                          ^ expected `bool`, found integer

error[E0308]: mismatched types
   --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:175:57
    |
175 |                 self.window.setFrame_display_(new_rect, 0);
    |                                                         ^ expected `bool`, found integer

error[E0308]: mismatched types
    --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:1301:48
     |
1301 |         window.setFrame_display_(current_rect, 0)
     |                                                ^ expected `bool`, found integer

error[E0308]: mismatched types
    --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:1308:48
     |
1308 |         window.setFrame_display_(current_rect, 0)
     |                                                ^ expected `bool`, found integer

error[E0308]: mismatched types
    --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:1325:48
     |
1325 |         window.setFrame_display_(current_rect, 0)
     |                                                ^ expected `bool`, found integer

error[E0308]: mismatched types
    --> /Users/camille/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/macos/window.rs:1332:48
     |
1332 |         window.setFrame_display_(current_rect, 0)
     |                                                ^ expected `bool`, found integer

error: aborting due to 7 previous errors

For more information about this error, try `rustc --explain E0308`.
error: could not compile `winit`
sunjay commented 3 years ago

Sorry about the issue you're running into! We've been unable to release a new version of turtle for a few years because of dependency issues (#183). That means that the version on crates.io is severely outdated and won't work on most machines these days. :(

You can usually address this by switching to the master branch as detailed here: https://github.com/sunjay/turtle/issues/202#issuecomment-695811144. You will still run into issues on Mac because of #183, but the crate should be mostly usable.

Appreciate you reporting this issue! Please let me know if this suggestion resolves things for you.

ssempervirens commented 3 years ago

Thanks for the response! I gave that a try, and replaced the crate line in my cargo.toml file with turtle = {git = "https://github.com/sunjay/turtle", rev = "bf64b8333a2be1914378d8a22a4788947711182b"}.

Unfortunately, I get the same error as before with winit. It seems like this workaround no longer works for some reason. In any case it sounds like this issue isn't new, but what might be new is that switching to the master branch doesn't work?

Thanks again.

gaetgu commented 3 years ago

I am also having the same issue even after putting the suggested line in.

sunjay commented 3 years ago

Does it work if you use the following in your Cargo.toml? (Removed the rev so it uses the latest master branch)

turtle = {git = "https://github.com/sunjay/turtle"}

You may need to run cargo update in conjunction with this to make sure Cargo updates your Cargo.lock file to the latest revision of this repository.

Please keep in mind that the crate will have some known bugs (#183) when you use the master branch like this. It should hopefully still be fairly usable though.

sunjay commented 2 years ago

Appears to be fixed now (at least on the master branch). Make sure you run cargo update so you have latest version of all the dependencies. My Cargo.lock file lists winit version 0.25.0 and that seems to work fine.