getditto / safer_ffi

Write safer FFI code in Rust without polluting it with unsafe code
http://getditto.github.io/safer_ffi
MIT License
925 stars 40 forks source link

Does not work on true no_std, bare metal target #120

Closed stevefan1999-personal closed 2 years ago

stevefan1999-personal commented 2 years ago

This is compiling for a amd64 kernel that does not have libc yet.

   Compiling yakern v0.1.0 (C:\Users\steve\rust\yakern\yakern)
   Compiling safer-ffi v0.0.10
error[E0432]: unresolved import `libc::size_t`                                                                                                                                                                                                                                                                         
  --> C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\utils\prelude.rs:29:19
   |
29 | pub(in crate) use ::libc::size_t;
   |                   ^^^^^^^^^^^^^^ no `size_t` in the root

error[E0412]: cannot find type `uintptr_t` in crate `libc`                                                                                                                                                                                                                                                             
 --> C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\layout\impls.rs:4:36
  |
4 |     ::core::mem::size_of::<::libc::uintptr_t>()
  |                                    ^^^^^^^^^ not found in `libc`

error[E0412]: cannot find type `size_t` in crate `libc`
 --> C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\layout\impls.rs:6:36
  |
6 |     ::core::mem::size_of::<::libc::size_t>()
  |                                    ^^^^^^ not found in `libc`

error[E0412]: cannot find type `c_char` in crate `libc`
  --> C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\c_char.rs:35:39
   |
35 |         let _ = is_u8_or_i8::<::libc::c_char>;
   |                                       ^^^^^^ not found in `libc`
   |
help: consider importing one of these items
   |
1  | use core::ffi::c_char;
   |
1  | use crate::c_char;
   |
1  | use crate::core::ffi::c_char;
   |
help: if you import `c_char`, refer to it directly
   |
35 -         let _ = is_u8_or_i8::<::libc::c_char>;
35 +         let _ = is_u8_or_i8::<c_char>;
   |

error[E0080]: evaluation of constant value failed                                                                                                                                                                                                                                                                      
   --> C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\utils\macros.rs:105:13
    |
105 |               COND
    |               ^^^^ referenced constant has errors
    |
   ::: C:\Users\steve\.cargo\registry\src\github.com-1ecc6299db9ec823\safer-ffi-0.0.10\src\layout\impls.rs:3:1
    |
3   | / const_assert! {
4   | |     ::core::mem::size_of::<::libc::uintptr_t>()
5   | |     ==
6   | |     ::core::mem::size_of::<::libc::size_t>()
7   | | }
    | |_- in this macro invocation
    |
    = note: this error originates in the macro `const_assert` (in Nightly builds, run with -Z macro-backtrace for more info)