sunshine-protocol/sunscreen

mac os build error

Closed this issue · 2 comments

I think the build is failing on mac OS because it can't compile the ffi-helpers crate

   Compiling keystore-ffi v0.1.0 (/Users/4meta5/flutter-bin/sunshine-flutter/keystore/keystore-ffi)
error[E0080]: it is undefined behavior to use this value
  --> /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/ffi_helpers-0.1.0/src/nullable.rs:20:13
   |
20 |             const NULL: Self = 0 as $type;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
...
38 | impl_nullable!(*const T, <T>);
   | ------------------------------ in this macro invocation
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0080]: it is undefined behavior to use this value
  --> /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/ffi_helpers-0.1.0/src/nullable.rs:20:13
   |
20 |             const NULL: Self = 0 as $type;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
...
39 | impl_nullable!(*mut T, <T>);
   | ---------------------------- in this macro invocation
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0080`.
error: could not compile `ffi_helpers`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

so I bumped the version from 0.1.0 to 0.2.0 and now I get this error

Compiling keystore-ffi v0.1.0 (/Users/4meta5/flutter-bin/sunshine-flutter/keystore/keystore-ffi)
error[E0080]: it is undefined behavior to use this value
  --> /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/ffi_helpers-0.2.0/src/nullable.rs:29:5
   |
29 |     const NULL: Self = std::ptr::null();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.

error[E0080]: it is undefined behavior to use this value
  --> /Users/4meta5/.cargo/registry/src/github.com-1ecc6299db9ec823/ffi_helpers-0.2.0/src/nullable.rs:36:5
   |
36 |     const NULL: Self = std::ptr::null_mut();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
   |
   = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0080`.
error: could not compile `ffi_helpers`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.

LOL, idk about that

What rust version are you using? Stable should work, you don't need nightly

Yup, it seems to be a mistake with a nightly change rust-lang/rust#71353

it does compile with stable