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

Unable to compile on a Apple silicon macOS #4

Open
s4m13337 opened this issue Aug 8, 2024 · 0 comments
Open

Unable to compile on a Apple silicon macOS #4

s4m13337 opened this issue Aug 8, 2024 · 0 comments

Comments

@s4m13337
Copy link

s4m13337 commented Aug 8, 2024

I got 1 warning and 4 errors when trying to compile on macOS:

warning: creating a shared reference to mutable static is discouraged
   --> src/lib.rs:284:24
    |
284 |         match unsafe { &SHARED_MEMORY_FILE_PATH } {
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
    = note: this will be a hard error in the 2024 edition
    = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
    = note: `#[warn(static_mut_refs)]` on by default
help: use `addr_of!` instead to create a raw pointer
    |
284 |         match unsafe { addr_of!(SHARED_MEMORY_FILE_PATH) } {
    |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
    --> src/lib.rs:1071:88
     |
1071 |             SharedMemoryType::Unsigned32 => get_shared_memory_flatten_data_unsigned_32(numeric_array_data as *mut u32),
     |                                             ------------------------------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u64`, found `*mut u32`
     |                                             |
     |                                             arguments to this function are incorrect
     |
     = note: expected raw pointer `*mut u64`
                found raw pointer `*mut u32`
note: function defined here
    --> src/lib.rs:641:23
     |
641  |     pub extern "C" fn get_shared_memory_flatten_data_unsigned_32(array_source: *mut c_ulong) -> c_int {
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------------------

error[E0308]: mismatched types
    --> src/lib.rs:1075:84
     |
1075 |             SharedMemoryType::Signed32 => get_shared_memory_flatten_data_signed_32(numeric_array_data as *mut i32),
     |                                           ---------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut i64`, found `*mut i32`
     |                                           |
     |                                           arguments to this function are incorrect
     |
     = note: expected raw pointer `*mut i64`
                found raw pointer `*mut i32`
note: function defined here
    --> src/lib.rs:677:23
     |
677  |     pub extern "C" fn get_shared_memory_flatten_data_signed_32(array_source: *mut c_long) -> c_int {
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -------------------------

error[E0308]: mismatched types
    --> src/lib.rs:1255:51
     |
1255 | ...5 => set_shared_memory_data_signed_32(numeric_array_data as *const i32, numeric_array_dimensions, numeric_array_rank),
     |         -------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const i64`, found `*const i32`
     |         |
     |         arguments to this function are incorrect
     |
     = note: expected raw pointer `*const i64`
                found raw pointer `*const i32`
note: function defined here
    --> src/lib.rs:805:23
     |
805  |     pub extern "C" fn set_shared_memory_data_signed_32(
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
806  |         data: *const c_long,
     |         -------------------

error[E0308]: mismatched types
    --> src/lib.rs:1258:53
     |
1258 | ... => set_shared_memory_data_unsigned_32(numeric_array_data as *const u32, numeric_array_dimensions, numeric_array_rank),
     |        ---------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u64`, found `*const u32`
     |        |
     |        arguments to this function are incorrect
     |
     = note: expected raw pointer `*const u64`
                found raw pointer `*const u32`
note: function defined here
    --> src/lib.rs:753:23
     |
753  |     pub extern "C" fn set_shared_memory_data_unsigned_32(
     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
754  |         data: *const c_ulong,
     |         --------------------

For more information about this error, try `rustc --explain E0308`.
warning: `shared_memory` (lib) generated 1 warning
error: could not compile `shared_memory` (lib) due to 4 previous errors; 1 warning emitted

Any ideas how I can get it to compile?

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