desbma / gotify-desktop

Small Gotify daemon to send messages as desktop notifications
GNU General Public License v3.0
49 stars 1 forks source link

1.2.0 compilation fails #6

Closed uuksu closed 2 years ago

uuksu commented 2 years ago

Hey!

I tried to install Gotify Desktop from the AUR with my Manjaro 21.2.2. Compilation seems to be failing for some reason. I also cloned the repository and tried to manually build the latest commit and the one marked with 1.2.0 tag. These failed with the same errors. For compilation I used the Rust installed by rustup.

Here is the output log I'm getting from running cargo build --release:

~/src/gotify-desktop-1.2.0 >>> cargo build --release                                           
   Compiling proc-macro2 v1.0.30
   Compiling autocfg v1.0.1
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.80
   Compiling libc v0.2.103
   Compiling cfg-if v1.0.0
   Compiling log v0.4.14
   Compiling serde_derive v1.0.130
   Compiling serde v1.0.130
   Compiling memchr v2.4.1
   Compiling pin-project-lite v0.2.7
   Compiling futures-core v0.3.17
   Compiling proc-macro-hack v0.5.19
   Compiling bytes v1.1.0
   Compiling proc-macro-nested v0.1.7
   Compiling futures-channel v0.3.17
   Compiling futures-sink v0.3.17
   Compiling cc v1.0.71
   Compiling futures-io v0.3.17
   Compiling futures-task v0.3.17
   Compiling pkg-config v0.3.20
   Compiling slab v0.4.5
   Compiling bitflags v1.3.2
   Compiling once_cell v1.8.0
   Compiling itoa v0.4.8
   Compiling pin-utils v0.1.0
   Compiling foreign-types-shared v0.1.1
   Compiling fnv v1.0.7
   Compiling openssl v0.10.36
   Compiling typenum v1.14.0
   Compiling version_check v0.9.3
   Compiling httparse v1.5.1
   Compiling tinyvec_macros v0.1.0
   Compiling matches v0.1.9
   Compiling native-tls v0.2.8
   Compiling lazy_static v1.4.0
   Compiling ryu v1.0.5
   Compiling percent-encoding v2.1.0
   Compiling crc32fast v1.2.1
   Compiling openssl-probe v0.1.4
   Compiling hashbrown v0.11.2
   Compiling nix v0.17.0
   Compiling waker-fn v1.1.0
   Compiling parking v2.0.0
   Compiling try-lock v0.2.3
   Compiling fastrand v1.5.0
   Compiling adler v1.0.2
   Compiling byteorder v1.4.3
   Compiling ppv-lite86 v0.2.14
   Compiling cache-padded v1.1.1
   Compiling unicode-bidi v0.3.7
   Compiling tower-service v0.3.1
   Compiling encoding_rs v0.8.28
   Compiling static_assertions v1.1.0
   Compiling void v1.0.2
   Compiling httpdate v1.0.1
   Compiling cfg-if v0.1.10
   Compiling base64 v0.13.0
   Compiling opaque-debug v0.3.0
   Compiling anyhow v1.0.44
   Compiling serde_json v1.0.68
   Compiling scoped-tls v1.0.0
   Compiling cpufeatures v0.2.1
   Compiling utf-8 v0.7.6
   Compiling mime v0.3.16
   Compiling ipnet v2.3.1
   Compiling instant v0.1.11
   Compiling foreign-types v0.3.2
   Compiling input_buffer v0.4.0
   Compiling http v0.2.5
   Compiling tinyvec v1.5.0
   Compiling tracing-core v0.1.21
   Compiling form_urlencoded v1.0.1
   Compiling concurrent-queue v1.2.2
   Compiling futures-macro v0.3.17
   Compiling futures-util v0.3.17
   Compiling tokio v1.12.0
   Compiling indexmap v1.7.0
   Compiling miniz_oxide v0.4.4
error[E0658]: `while` is not allowed in a `const fn`
  --> /home/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.5/src/header/value.rs:85:9
   |
85 | /         while i < bytes.len() {
86 | |             if !is_visible_ascii(bytes[i]) {
87 | |                 ([] as [u8; 0])[0]; // Invalid header value
88 | |             }
89 | |             i += 1;
90 | |         }
   | |_________^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/52000

error[E0658]: `if` is not allowed in a `const fn`
  --> /home/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/http-0.2.5/src/header/value.rs:86:13
   |
86 | /             if !is_visible_ascii(bytes[i]) {
87 | |                 ([] as [u8; 0])[0]; // Invalid header value
88 | |             }
   | |_____________^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/49146

   Compiling generic-array v0.14.4
   Compiling tracing v0.1.29
   Compiling want v0.3.0
   Compiling simple_logger v1.13.0
error: attributes are not yet allowed on `if` expressions
   --> /home/myusername/.cargo/registry/src/github.com-1ecc6299db9ec823/simple_logger-1.13.0/src/lib.rs:306:13
    |
306 |             #[cfg(feature = "chrono")]
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^

   Compiling quote v1.0.10
   Compiling futures-lite v1.12.0
error: aborting due to previous error

error: could not compile `simple_logger`.
warning: build failed, waiting for other jobs to finish...
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: could not compile `http`.
warning: build failed, waiting for other jobs to finish...
error: build failed

If I can provide you any more information, please let me know!

desbma commented 2 years ago

It looks like you have an outdated Rust environment, what does rustc -V output?

uuksu commented 2 years ago

It said: rustc 1.42.0 (b8cedc004 2020-03-09)

I updated rustc with rustup update and then tried installation from the AUR yet again. This time it compiled so you were absolutely correct!

I was wondering if there could be some kind of rustc version check when building the software from the AUR?

desbma commented 2 years ago

I don't think there is, but Arch Linux, and by extension Manjaro do not support partial upgrade, so if you are installing a new package like gotify-desktop, you are expected to have previously upgraded you system, and if you have installed the rust package you are at version 1.58. If you have installed rustup which I assume is the case since your rustc version is almost 1 year old, the toolchains are downloaded in your home directory so you can easily switch between them and you are then responsible to update them (via rustup update for example).

uuksu commented 2 years ago

Ah, I see. I'm not quite sure anymore about my Rust installation as it's been a while since the last time I've played with it. It's possible that I've installed rustup year ago and just forgot about it and today was the day I needed Rust for something.

Anyways, my Gotify Desktop works now, I've learned something new about Rust today and so this issue can be closed. Thank you for your help!

desbma commented 2 years ago

It's possible that I've installed rustup year ago and just forgot about it and today was the day I needed Rust for something.

If you want to avoid such problem in the future, I suggest you install the rust package (it will replace rustup on installation). That way you can rely on the usual package upgrade to maintain it up to date, and forget about it.

uuksu commented 2 years ago

Your AUR package has the rust package as depedency so it was actually installed on my machine at that point when I first tried to build the package and yet it still failed to compile. I'm pretty sure that my the default rust installation (one coming from Manjaro official repo) was overridden by older rust version I've installed. I'm not really sure how this even is possible, but hey it's one of the many Linux package management mysteries.