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

Fails to build on FreeBSD #431

Closed jbeich closed 3 weeks ago

jbeich commented 3 weeks ago

Regressed by bcca03cce7da. rlim_t is i64 on DragonFly and FreeBSD and u64 on NetBSD and OpenBSD plus macOS. On BSDs it's 64-bit even on 32-bit architectures.

error[E0308]: mismatched types
    --> src/utils/spawning.rs:33:38
     |
33   |     ORIGINAL_NOFILE_RLIMIT_CUR.store(rlim.rlim_cur, Ordering::SeqCst);
     |                                ----- ^^^^^^^^^^^^^ expected `u64`, found `i64`
     |                                |
     |                                arguments to this method are incorrect
     |
note: method defined here
    --> /usr/local/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:3151:1
     |
3151 | / atomic_int! {
3152 | |     cfg(target_has_atomic = "64"),
3153 | |     cfg(target_has_atomic_equal_alignment = "64"),
3154 | |     stable(feature = "integer_atomics_stable", since = "1.34.0"),
...    |
3166 | |     u64 AtomicU64
3167 | | }
     | |_^
     = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
     |
33   |     ORIGINAL_NOFILE_RLIMIT_CUR.store(rlim.rlim_cur.try_into().unwrap(), 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 `i64`
     |                                |
     |                                arguments to this method are incorrect
     |
note: method defined here
    --> /usr/local/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:3151:1
     |
3151 | / atomic_int! {
3152 | |     cfg(target_has_atomic = "64"),
3153 | |     cfg(target_has_atomic_equal_alignment = "64"),
3154 | |     stable(feature = "integer_atomics_stable", since = "1.34.0"),
...    |
3166 | |     u64 AtomicU64
3167 | | }
     | |_^
     = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit
     |
34   |     ORIGINAL_NOFILE_RLIMIT_MAX.store(rlim.rlim_max.try_into().unwrap(), Ordering::SeqCst);
     |                                                   ++++++++++++++++++++

error[E0308]: mismatched types
  --> src/utils/spawning.rs:58:25
   |
58 |     let rlim = rlimit { rlim_cur, rlim_max };
   |                         ^^^^^^^^ expected `i64`, found `u64`
   |
help: you can convert a `u64` to an `i64` 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 `i64`, found `u64`
   |
help: you can convert a `u64` to an `i64` 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

System Information

$ rustc -vV
rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-freebsd
release: 1.78.0
LLVM version: 18.1.2
YaLTeR commented 3 weeks ago

Well, that's fun. Thanks for bringing this up!

YaLTeR commented 3 weeks ago

Could you check if f203c8729a8535f6a317df5a35dc01306be2e45c fixes it?

jbeich commented 3 weeks ago

I confirm, builds fine now. Test both amd64 and i386.

YaLTeR commented 3 weeks ago

Awesome, thanks.