YaLTeR/niri

Error while compiling

Closed this issue · 5 comments

10:34:04 owl@eeepc niri ±|main|→ cargo build --release -j8 Compiling niri v0.1.6 (/home/owl/niri) error[E0308]: mismatched types --> src/utils/spawning.rs:33:38 | 33 | ORIGINAL_NOFILE_RLIMIT_CUR.store(rlim.rlim_cur, Ordering::SeqCst); | ----- ^^^^^^^^^^^^^ expected u64, found u32| | | arguments to this method are incorrect | note: method defined here --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/sync/atomic.rs:3151:1 = note: this error originates in the macroatomic_int(in Nightly builds, run with -Z macro-backtrace for more info) help: you can convert au32to au64`
|
33 | ORIGINAL_NOFILE_RLIMIT_CUR.store(rlim.rlim_cur.into(), Ordering::SeqCst);
| +++++++

error[E0308]: mismatched types
--> src/utils/spawning.rs:34:38
|
34 | ORIGINAL_NOFILE_RLIMIT_MAX.store(rlim.rlim_max, Ordering::SeqCst);
| ----- ^^^^^^^^^^^^^ expected u64, found u32
| |
| arguments to this method are incorrect
|
note: method defined here
--> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/sync/atomic.rs:3151:1
= note: this error originates in the macro atomic_int (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a u32 to a u64
|
34 | ORIGINAL_NOFILE_RLIMIT_MAX.store(rlim.rlim_max.into(), Ordering::SeqCst);
| +++++++

error[E0308]: mismatched types
--> src/utils/spawning.rs:58:25
|
58 | let rlim = rlimit { rlim_cur, rlim_max };
| ^^^^^^^^ expected u32, found u64
|
help: you can convert a u64 to a u32 and panic if the converted value doesn't fit
|
58 | let rlim = rlimit { rlim_cur: rlim_cur.try_into().unwrap(), rlim_max };
| +++++++++ ++++++++++++++++++++

error[E0308]: mismatched types
--> src/utils/spawning.rs:58:35
|
58 | let rlim = rlimit { rlim_cur, rlim_max };
| ^^^^^^^^ expected u32, found u64
|
help: you can convert a u64 to a u32 and panic if the converted value doesn't fit
|
58 | let rlim = rlimit { rlim_cur, rlim_max: rlim_max.try_into().unwrap() };
| +++++++++ ++++++++++++++++++++

For more information about this error, try rustc --explain E0308.
error: could not compile niri (lib) due to 4 previous errors
10:35:24 owl@eeepc niri ±|main|→`

I know basic Rust, trying to fix it myself.

System Information

  • niri version: master Git branch
  • Distro: Debian Bookworm (i386)
  • GPU: Intel Atom Integrated Graphics
  • CPU: Intel Atom N270

Uh huh. Does it have a different rlimit type in libc?

I think you should be able to work around this by changing those two AtomicU64 to AtomicU32.

This is similar to #431; I'll think of some way to fix it.

Could you check if f203c87 fixes it?

Should be fixed by that commit.