jtmoon79 / super-speedy-syslog-searcher

Speedily search and merge log messages by datetime
MIT License
42 stars 2 forks source link

fails to compile on NetBSD 9.3 amd64 (`uapi` crate differences) #121

Closed jtmoon79 closed 7 months ago

jtmoon79 commented 1 year ago

Due to uapi

$ cargo install super_speedy_syslog_searcher
...
   Compiling bstr v1.4.0
error[E0425]: cannot find value `F_SETPIPE_SZ` in module `c`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/fcntl/mod.rs:67:40
   |
67 |     let res = unsafe { c::fcntl(fd, c::F_SETPIPE_SZ, size) };
   |                                        ^^^^^^^^^^^^ not found in `c`

error[E0425]: cannot find value `F_GETPIPE_SZ` in module `c`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/fcntl/mod.rs:74:40
   |
74 |     let res = unsafe { c::fcntl(fd, c::F_GETPIPE_SZ) };
   |                                        ^^^^^^^^^^^^ not found in `c`

error[E0425]: cannot find function `posix_fadvise` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/file/mod.rs:254:27
    |
254 |     let val = unsafe { c::posix_fadvise(fd, offset, len, advice) };
    |                           ^^^^^^^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/bsd/mod.rs:673:5
    |
673 |     pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
    |     ------------------------------------------------------------------------------------ similarly named function `posix_madvise` defined here
    |
help: a function with a similar name exists
    |
254 |     let val = unsafe { c::posix_madvise(fd, offset, len, advice) };
    |                           ~~~~~~~~~~~~~
help: consider importing this function
    |
1   | use crate::posix_fadvise;
    |
help: if you import `posix_fadvise`, refer to it directly
    |
254 -     let val = unsafe { c::posix_fadvise(fd, offset, len, advice) };
254 +     let val = unsafe { posix_fadvise(fd, offset, len, advice) };
    |

error[E0425]: cannot find function `posix_fallocate` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/file/mod.rs:261:27
    |
261 |     let val = unsafe { c::posix_fallocate(fd, offset, len) };
    |                           ^^^^^^^^^^^^^^^ not found in `c`
    |
help: consider importing this function
    |
1   | use crate::posix_fallocate;
    |
help: if you import `posix_fallocate`, refer to it directly
    |
261 -     let val = unsafe { c::posix_fallocate(fd, offset, len) };
261 +     let val = unsafe { posix_fallocate(fd, offset, len) };
    |

error[E0412]: cannot find type `ucred` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/pod.rs:202:8
    |
202 |       c::ucred
    |          ^^^^^ help: a struct with a similar name exists: `uucred`
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/bsd/netbsdlike/netbsd/mod.rs:95:1
    |
95  | / s! {
96  | |     pub struct aiocb {
97  | |         pub aio_offset: ::off_t,
98  | |         pub aio_buf: *mut ::c_void,
...   |
754 | |     }
755 | | }
    | |_- similarly named struct `uucred` defined here

error[E0412]: cannot find type `ip_mreqn` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/pod.rs:205:8
    |
205 |       c::ip_mreqn
    |          ^^^^^^^^ help: a struct with a similar name exists: `ip_mreq`
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/bsd/netbsdlike/netbsd/mod.rs:757:1
    |
757 | / s_no_extra_traits! {
758 | |
759 | |     pub struct utmpx {
760 | |         pub ut_name: [::c_char; _UTX_USERSIZE],
...   |
878 | |     }
879 | | }
    | |_- similarly named struct `ip_mreq` defined here

error[E0425]: cannot find function `fexecve` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/process/mod.rs:112:27
    |
112 |       let res = unsafe { c::fexecve(fd, argv.as_ptr(), envp.as_ptr()) };
    |                             ^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/mod.rs:887:5
    |
887 | /     pub fn execve(
888 | |         prog: *const c_char,
889 | |         argv: *const *const c_char,
890 | |         envp: *const *const c_char,
891 | |     ) -> ::c_int;
    | |________________- similarly named function `execve` defined here
    |
help: a function with a similar name exists
    |
112 |     let res = unsafe { c::execve(fd, argv.as_ptr(), envp.as_ptr()) };
    |                           ~~~~~~
help: consider importing this function
    |
3   | use crate::fexecve;
    |
help: if you import `fexecve`, refer to it directly
    |
112 -     let res = unsafe { c::fexecve(fd, argv.as_ptr(), envp.as_ptr()) };
112 +     let res = unsafe { fexecve(fd, argv.as_ptr(), envp.as_ptr()) };
    |

error[E0425]: cannot find function `setresuid` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/process/mod.rs:231:27
    |
231 |     let res = unsafe { c::setresuid(ruid, euid, suid) };
    |                           ^^^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/mod.rs:930:5
    |
930 |     pub fn setreuid(ruid: uid_t, euid: uid_t) -> ::c_int;
    |     ---------------------------------------------------- similarly named function `setreuid` defined here
    |
help: a function with a similar name exists
    |
231 |     let res = unsafe { c::setreuid(ruid, euid, suid) };
    |                           ~~~~~~~~
help: consider importing this function
    |
3   | use crate::setresuid;
    |
help: if you import `setresuid`, refer to it directly
    |
231 -     let res = unsafe { c::setresuid(ruid, euid, suid) };
231 +     let res = unsafe { setresuid(ruid, euid, suid) };
    |

error[E0425]: cannot find function `setresgid` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/process/mod.rs:238:27
    |
238 |     let res = unsafe { c::setresgid(rgid, egid, sgid) };
    |                           ^^^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/mod.rs:931:5
    |
931 |     pub fn setregid(rgid: gid_t, egid: gid_t) -> ::c_int;
    |     ---------------------------------------------------- similarly named function `setregid` defined here
    |
help: a function with a similar name exists
    |
238 |     let res = unsafe { c::setregid(rgid, egid, sgid) };
    |                           ~~~~~~~~
help: consider importing this function
    |
3   | use crate::setresgid;
    |
help: if you import `setresgid`, refer to it directly
    |
238 -     let res = unsafe { c::setresgid(rgid, egid, sgid) };
238 +     let res = unsafe { setresgid(rgid, egid, sgid) };
    |

error[E0425]: cannot find function `getresuid` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/process/mod.rs:246:27
    |
246 |     let res = unsafe { c::getresuid(&mut ruid, &mut euid, &mut suid) };
    |                           ^^^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/mod.rs:897:5
    |
897 |     pub fn geteuid() -> uid_t;
    |     ------------------------- similarly named function `geteuid` defined here
    |
help: a function with a similar name exists
    |
246 |     let res = unsafe { c::geteuid(&mut ruid, &mut euid, &mut suid) };
    |                           ~~~~~~~
help: consider importing this function
    |
3   | use crate::getresuid;
    |
help: if you import `getresuid`, refer to it directly
    |
246 -     let res = unsafe { c::getresuid(&mut ruid, &mut euid, &mut suid) };
246 +     let res = unsafe { getresuid(&mut ruid, &mut euid, &mut suid) };
    |

error[E0425]: cannot find function `getresgid` in module `c`
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/process/mod.rs:254:27
    |
254 |     let res = unsafe { c::getresgid(&mut rgid, &mut egid, &mut sgid) };
    |                           ^^^^^^^^^
    |
   ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.144/src/unix/mod.rs:896:5
    |
896 |     pub fn getegid() -> gid_t;
    |     ------------------------- similarly named function `getegid` defined here
    |
help: a function with a similar name exists
    |
254 |     let res = unsafe { c::getegid(&mut rgid, &mut egid, &mut sgid) };
    |                           ~~~~~~~
help: consider importing this function
    |
3   | use crate::getresgid;
    |
help: if you import `getresgid`, refer to it directly
    |
254 -     let res = unsafe { c::getresgid(&mut rgid, &mut egid, &mut sgid) };
254 +     let res = unsafe { getresgid(&mut rgid, &mut egid, &mut sgid) };
    |

error[E0425]: cannot find value `ALIGN` in this scope
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/socket/cmsg.rs:31:13
   |
31 |     (size + ALIGN) & !ALIGN
   |             ^^^^^ not found in this scope

error[E0425]: cannot find value `ALIGN` in this scope
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/socket/cmsg.rs:31:23
   |
31 |     (size + ALIGN) & !ALIGN
   |                       ^^^^^ not found in this scope

error[E0425]: cannot find value `ALIGN` in this scope
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/socket/cmsg.rs:78:40
   |
30 | const fn align(size: usize) -> usize {
   | ------------------------------------ similarly named function `align` defined here
...
78 |     if usize::max_value() - cmsg_len < ALIGN {
   |                                        ^^^^^ help: a function with a similar name exists: `align`

note: erroneous constant used
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/socket/cmsg.rs:41:17
   |
41 |     bytes: [u8; HDR_SPACE],
   |                 ^^^^^^^^^

note: erroneous constant used
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/uapi-0.2.10/src/socket/cmsg.rs:65:20
   |
65 |         bytes: [0; HDR_SPACE],
   |                    ^^^^^^^^^

Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `uapi` due to 14 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `super_speedy_syslog_searcher v0.6.64`, intermediate artifacts can be found at `/tmp/cargo-installXxRsmE`

Environment:

...

Similar to #100 #108 , another compilation failure due to crate uapi.

jtmoon79 commented 1 year ago

Another reason to implement #109: hardcode the structures that uapi generates on different platforms. Do so such that different versions of the utmp and the utmpx C struct can be chosen from at run-time (the point of #109). Removing crate uapi should also fix #100.

jtmoon79 commented 7 months ago

Verified this built on NetBSD 9.3 x64.