DevinR528 / rumatui

WIP Command line Matrix client using matrix-rust-sdk
Apache License 2.0
63 stars 5 forks source link

"error: attribute must be applied to a `static` variable" when compiling #15

Open jerzybrzoska opened 3 years ago

jerzybrzoska commented 3 years ago

I cloned the repo and run cargo run --release. The process of compilation was not finished due to the following error:

Compiling olm-rs v0.5.0
error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/account.rs:41:5
   |
41 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/inbound_group_session.rs:29:5
   |
29 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/outbound_group_session.rs:30:5
   |
30 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/session.rs:34:5
   |
34 |     #[used]
   |     ^^^^^^^

error: aborting due to 4 previous errors

error: could not compile `olm-rs`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

When I repeated the attempt with --verbose I got the following output from the compiler:

Running `rustc --crate-name olm_rs --edition=2018 /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="deserialization"' --cfg 'feature="serde"' --cfg 'feature="serde_json"' -C metadata=b157c7051a06e790 -C extra-filename=-b157c7051a06e790 --out-dir /home/jerzy/rumatui/target/release/deps -L dependency=/home/jerzy/rumatui/target/release/deps --extern getrandom=/home/jerzy/rumatui/target/release/deps/libgetrandom-2876f5851e514e72.rmeta --extern olm_sys=/home/jerzy/rumatui/target/release/deps/libolm_sys-83cc2e8b5962926b.rmeta --extern serde=/home/jerzy/rumatui/target/release/deps/libserde-fc9870fbedeeacc2.rmeta --extern serde_json=/home/jerzy/rumatui/target/release/deps/libserde_json-c49d8bd238e2c4e4.rmeta --extern zeroize=/home/jerzy/rumatui/target/release/deps/libzeroize-c8c4f35876105ecb.rmeta --cap-lints allow -L /home/jerzy/rumatui/target/release/build/olm-sys-17d37e7a7ca77f18/out/build`
       Fresh image v0.23.7
error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/account.rs:41:5
   |
41 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/inbound_group_session.rs:29:5
   |
29 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/outbound_group_session.rs:30:5
   |
30 |     #[used]
   |     ^^^^^^^

error: attribute must be applied to a `static` variable
  --> /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/session.rs:34:5
   |
34 |     #[used]
   |     ^^^^^^^

error: aborting due to 4 previous errors

error: could not compile `olm-rs`

Caused by:
  process didn't exit successfully: `rustc --crate-name olm_rs --edition=2018 /home/jerzy/.cargo/registry/src/github.com-1ecc6299db9ec823/olm-rs-0.5.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="deserialization"' --cfg 'feature="serde"' --cfg 'feature="serde_json"' -C metadata=b157c7051a06e790 -C extra-filename=-b157c7051a06e790 --out-dir /home/jerzy/rumatui/target/release/deps -L dependency=/home/jerzy/rumatui/target/release/deps --extern getrandom=/home/jerzy/rumatui/target/release/deps/libgetrandom-2876f5851e514e72.rmeta --extern olm_sys=/home/jerzy/rumatui/target/release/deps/libolm_sys-83cc2e8b5962926b.rmeta --extern serde=/home/jerzy/rumatui/target/release/deps/libserde-fc9870fbedeeacc2.rmeta --extern serde_json=/home/jerzy/rumatui/target/release/deps/libserde_json-c49d8bd238e2c4e4.rmeta --extern zeroize=/home/jerzy/rumatui/target/release/deps/libzeroize-c8c4f35876105ecb.rmeta --cap-lints allow -L /home/jerzy/rumatui/target/release/build/olm-sys-17d37e7a7ca77f18/out/build` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: build failed
DevinR528 commented 3 years ago

Ahh crap! It's because of matrix-sdk but I think you can get around by using an older compiler (temporarily, I'll make a PR to update olm-rs in the sdk, or you could if you were interested?). I checked using rust 1.45 and it seems to work.

Thanks for the interest!!

jerzybrzoska commented 3 years ago

I'm too much of a newbie in Rust for such an update. I appreciate your help.

DevinR528 commented 3 years ago

I'll let you know when I get to fix this. In the mean time if you want

rustup install 1.45 minimal
rustup run 1.45 cargo r --release

would be the commands to do what you were doing. I'm not sure if 1.45 is the newest version that would actually work, I feel like I noticed it doing this a few weeks ago so maybe any compiler before 1.53 :shrug:

jerzybrzoska commented 3 years ago

Thanks, I managed to launch the app having compiled it with version 1.45. P.S. When I run error: invalid toolchain name: 'minimal' it failed and I got the output:

error: invalid toolchain name: 'minimal'

So I decided to skip the word minimal, like so: rustup install 1.45 && rustup run 1.45 cargo r --release and it worked fine.

DevinR528 commented 3 years ago

I was just reminded that because it was only a patch release running cargo update would have fixed it also :facepalm: so that would have been easier, sorry!

jerzybrzoska commented 3 years ago

To no avail. I have just run cargo updateand then cargo run --release and I got the same error

"error: attribute must be applied to a static variable"