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

Compilation failure on MacOS arm64 #44

Closed
schell opened this issue Jan 1, 2022 · 3 comments
Closed

Compilation failure on MacOS arm64 #44

schell opened this issue Jan 1, 2022 · 3 comments

Comments

@schell
Copy link
Contributor

schell commented Jan 1, 2022

I'm seeing errors in the corebluetooth code that looks like objective-c bindings stuff. I'm on macos arm64. This is a different compilation error than #39. I see this on every rustup channel I've tried so far including 1.59 (nightly), 1.57 (stable) and 1.56.

error[E0606]: casting `bool` as `*mut Object` is invalid
  --> /Users/schell/arm64_narrative/cargo/git/checkouts/bluster-a7618b078c3d8ba7/aa886ad/src/peripheral/corebluetooth/events.rs:40:67
   |
40 |                 delegate.set_ivar::<*mut Object>(POWERED_ON_IVAR, NO as *mut Object);
   |                                                                   ^^^^^^^^^^^^^^^^^

error[E0606]: casting `bool` as `*mut Object` is invalid
  --> /Users/schell/arm64_narrative/cargo/git/checkouts/bluster-a7618b078c3d8ba7/aa886ad/src/peripheral/corebluetooth/events.rs:44:67
   |
44 |                 delegate.set_ivar::<*mut Object>(POWERED_ON_IVAR, YES as *mut Object);
   |                                                                   ^^^^^^^^^^^^^^^^^^

error[E0054]: cannot cast as `bool`
  --> /Users/schell/arm64_narrative/cargo/git/checkouts/bluster-a7618b078c3d8ba7/aa886ad/src/peripheral/corebluetooth/into_bool.rs:19:9
   |
19 |         (self as BOOL).into_bool()
   |         ^^^^^^^^^^^^^^ unsupported cast

error[E0606]: casting `bool` as `*mut Object` is invalid
   --> /Users/schell/arm64_narrative/cargo/git/checkouts/bluster-a7618b078c3d8ba7/aa886ad/src/peripheral/corebluetooth/peripheral_manager.rs:230:59
    |
230 |         delegate.set_ivar::<*mut Object>(POWERED_ON_IVAR, NO as *mut Object);
    |                     
    ```
@schell
Copy link
Contributor Author

schell commented Jan 1, 2022

Removing the turbofish type applications and casts cuts down the errors to a single case:

error[E0054]: cannot cast as `bool`
  --> src/peripheral/corebluetooth/into_bool.rs:19:9
   |
19 |         (self as BOOL).into_bool()
   |         ^^^^^^^^^^^^^^ unsupported cast

@schell
Copy link
Contributor Author

schell commented Jan 3, 2022

I realized the previous strategy was a red herring after seeing the objc library's definition of BOOL and finding this comment on SO.

@schell
Copy link
Contributor Author

schell commented Jan 3, 2022

The issue linked above (SSheldon/rust-objc#110) seems to indicate that the problem is the way these ivars are being used. I'm providing a "fix". It seems to pass tests on my M1 but I don't understand the domain very well so please take it with a grain of salt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant