rpm-software-management / librpm.rs

Rust bindings to the RPM Package Manager libraries (librpm, librpmbuild, librpmsign)
https://rustrpm.org/librpm/
Mozilla Public License 2.0
31 stars 14 forks source link

librpm-sys Build Failure on Fedora 40 #48

Open LivacoNew opened 1 month ago

LivacoNew commented 1 month ago

Cloning & Running cargo test on Fedora 40 provides the following build failure;

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:70:17
   |
70 |     pub offset: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:71:15
   |
71 |     pub freq: __syscall_slong_t,
   |               ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:72:19
   |
72 |     pub maxerror: __syscall_slong_t,
   |                   ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:73:19
   |
73 |     pub esterror: __syscall_slong_t,
   |                   ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:75:19
   |
75 |     pub constant: __syscall_slong_t,
   |                   ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:76:20
   |
76 |     pub precision: __syscall_slong_t,
   |                    ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:77:20
   |
77 |     pub tolerance: __syscall_slong_t,
   |                    ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `timeval` in this scope
  --> librpm-sys/src/lib.rs:78:15
   |
78 |     pub time: timeval,
   |               ^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:79:15
   |
79 |     pub tick: __syscall_slong_t,
   |               ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:80:18
   |
80 |     pub ppsfreq: __syscall_slong_t,
   |                  ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:81:17
   |
81 |     pub jitter: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:83:17
   |
83 |     pub stabil: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:84:17
   |
84 |     pub jitcnt: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:85:17
   |
85 |     pub calcnt: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:86:17
   |
86 |     pub errcnt: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `__syscall_slong_t` in this scope
  --> librpm-sys/src/lib.rs:87:17
   |
87 |     pub stbcnt: __syscall_slong_t,
   |                 ^^^^^^^^^^^^^^^^^ not found in this scope

For more information about this error, try `rustc --explain E0412`.
error: could not compile `librpm-sys` (lib) due to 16 previous errors

This seems to be from a newer kernel, as my previous Fedora 39 was fine (although did build fail for different reasons, something I upgraded my VM to 40 to see if it would fix)

tarcieri commented 1 month ago

The code that's no longer compiling is part of a somewhat horrible hack to work around bindgen trying to build a binding for clock_adjtime. See the lengthy comment here: https://github.com/rpm-software-management/librpm.rs/blob/96e2fde/librpm-sys/src/lib.rs#L35-L66

The best solution would be to figure out how to eliminate clock_adjtime from the generated binding, then the definition of struct timex that's failing to compile can be removed.