pgcentralfoundation / pgrx

Build Postgres Extensions with Rust!
Other
3.71k stars 249 forks source link

New project fails to compile - M1 Mac #1920

Closed olirice closed 1 month ago

olirice commented 1 month ago

pgrx-pg-sys v0.12.6 fails to compile on an M1 Mac

The error occurs on new projects created with cargo pgrx new

   Compiling pgrx-pg-sys v0.12.6
error[E0425]: cannot find function `size_of` in this scope
   --> /Users/oli/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-pg-sys-0.12.6/src/submodules/datum.rs:136:41
    |
136 |                 let ptr = crate::palloc(size_of::<u64>()) as *mut u64;
    |                                         ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
11  + use core::mem::size_of;
    |
11  + use std::mem::size_of;
    |

error[E0425]: cannot find function `size_of` in this scope
   --> /Users/oliverrice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgrx-pg-sys-0.12.6/src/submodules/datum.rs:172:41
    |
172 |                 let ptr = crate::palloc(size_of::<i64>()) as *mut i64;
    |                                         ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
11  + use core::mem::size_of;
    |
11  + use std::mem::size_of;
    |

For more information about this error, try `rustc --explain E0425`.
error: could not compile `pgrx-pg-sys` (lib) due to 2 previous errors

Please let me know if theres anything other information I can provide to help run it down

olirice commented 1 month ago

Was being dense. My rust version was way out of date