tramhao / termusic

Music Player TUI written in Rust
GNU General Public License v3.0
952 stars 42 forks source link

Compilation issue: HeaderMap #343

Open auronandace opened 3 days ago

auronandace commented 3 days ago

Environment & Versions

Logs: compilation error, please see below

Description of the Problem

Failed to compile when using: cargo install termusic. When trying to compile the following error is displayed:

error[E0308]: mismatched types
   --> /home/auronandace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/termusic-playback-0.9.0/src/rusty_backend/mod.rs:656:60
    |
656 |             let client = Client::builder().default_headers(headers).build().unwrap();
    |                                            --------------- ^^^^^^^ expected `HeaderMap`, found `reqwest::header::HeaderMap`
    |                                            |
    |                                            arguments to this method are incorrect
    |
    = note: `reqwest::header::HeaderMap` and `HeaderMap` have similar names, but are actually distinct types
note: `reqwest::header::HeaderMap` is defined in crate `http`
   --> /home/auronandace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-0.2.12/src/header/map.rs:45:1
    |
45  | pub struct HeaderMap<T = HeaderValue> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `HeaderMap` is defined in crate `http`
   --> /home/auronandace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/http-1.1.0/src/header/map.rs:45:1
    |
45  | pub struct HeaderMap<T = HeaderValue> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `http` are being used?
note: method defined here
   --> /home/auronandace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.12.5/src/async_impl/client.rs:826:12
    |
826 |     pub fn default_headers(mut self, headers: HeaderMap) -> ClientBuilder {
    |            ^^^^^^^^^^^^^^^

It appears to be confusing HeaderMap from versions 0.2.12 and 1.1.0 of the http crate.

It does compile fine when using cargo install --locked termusic.

hasezoey commented 2 days ago

somewhat known issue, it is already fixed in master but no new version has been posted yet.

i recommend to directly install from git (cargo install --git https://github.com/tramhao/termusic.git, though i dont actually know if this only works for a single package or a whole workspace), or clone first and then manually install (cargo build --release && cp -f ./target/release/{termusic,termusic-server} ${CARGO_HOME}/bin/). or if you are using arch, consider trying termusic-git