YaLTeR / niri

A scrollable-tiling Wayland compositor.
https://matrix.to/#/#niri:matrix.org
GNU General Public License v3.0
2.82k stars 79 forks source link

Error while compiling #430

Closed Sovenok-Hacker closed 3 weeks ago

Sovenok-Hacker commented 3 weeks ago
`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 macro atomic_int (in Nightly builds, run with -Z macro-backtrace for more info) help: you can convert a u32 to a u64 | 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

YaLTeR commented 3 weeks ago

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

YaLTeR commented 3 weeks ago

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

YaLTeR commented 3 weeks ago

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

YaLTeR commented 3 weeks ago

Could you check if f203c8729a8535f6a317df5a35dc01306be2e45c fixes it?

YaLTeR commented 3 weeks ago

Should be fixed by that commit.