Rigellute / spotify-tui

Spotify for the terminal written in Rust 🚀
MIT License
17.52k stars 521 forks source link

No longer compiles (stable, beta and nightly) #1025

Open mucinoab opened 2 years ago

mucinoab commented 2 years ago

I think is due the the changes in the memory layout of SocketAddrV4 ( Rust-1.64, compatibility-notes).

Updating some of our dependencies should fix it.

image

❯ rustc --version --verbose

rustc 1.64.0 (a55dd71d5 2022-09-19) binary: rustc commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52 commit-date: 2022-09-19 host: x86_64-unknown-linux-gnu release: 1.64.0 LLVM version: 14.0.6

siris commented 2 years ago

I have confirmed this is also impacting spotify-tui compilations with Rust 1.65.0 (as expected) that was just released:

cargo build
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
   --> /home/ss/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.12/src/sockaddr.rs:176:9
    |
176 |         mem::transmute::<SocketAddrV4, sockaddr_in>(v4);
    |
    |
    = note: source type: `SocketAddrV4` (48 bits)
    = note: target type: `sockaddr_in` (128 bits)

This fix is quite simple: the socket2 crate just needs to be updated:

cargo update -p socket2
    Updating crates.io index
    Updating socket2 v0.3.12 -> v0.3.19

Once that is done I have confirmed cargo build work fine the latest HEAD commit of spotify-tui:

cargo build
  Downloaded socket2 v0.3.19
  Downloaded 1 crate (33.8 KB) in 0.33s
   Compiling spotify-tui v0.25.0 (/home/ss/Repos/spotify-tui)
    Finished dev [unoptimized + debuginfo] target(s) in 20.26s

To further confirm running a cargo install --path . on the latest HEAD commit also works:

cargo install --path .
 Installing spotify-tui v0.25.0 (/home/ss/Repos/spotify-tui)
  Installing /home/ss/.cargo/bin/spt
   Installed package `spotify-tui v0.25.0 (/home/ss/Repos/spotify-tui)` (executable `spt`)

spt --version
spotify-tui 0.25.0

A quick PR with this Cargo.lock update along with a new patch release should fix this fully for Rust 1.64.0 and beyond.

siris commented 2 years ago

@Rigellute this is a pretty critical issue as compilations of spotify-tui are completely broken on Rust 1.64.0 and beyond. This breaks any Linux distro or user trying to compile it as part of package management systems or directly from git.

I have tested and verified the fix above and it looks like an automated Cargo.lock PR #990 already is opened with the required fix.

When possible can that PR be merged and a new patch Crate version be released of spotify-tui (v0.25.1) to resolve this?

siris commented 2 years ago

Reference Funtoo Linux Bug tracking this: https://bugs.funtoo.org/browse/FL-10687

siris commented 1 year ago

@Rigellute bump on this issue. Is there any possibility of someone reviewing PR #990, getting it merged and doing a quick patch version release of spotify-tui so it can successfully compile with Rust 1.64.0 and beyond?