plietar / librespot

Open Source Spotify client library
MIT License
1.14k stars 185 forks source link

Error when building on macOS #174

Closed donholly closed 7 years ago

donholly commented 7 years ago

I'm having an issue when trying to build on macOS:

rustc --version
rustc 1.16.0

cargo --version
cargo-0.17.0-dev (f9e5481 2017-03-03)

cargo build --release

Produces:

   Compiling librespot v0.1.0 (file:///Users/don/src/home/librespot)
error: custom derive attribute panicked
  --> src/apresolve.rs:11:24
   |
11 | #[derive(Clone, Debug, Serialize, Deserialize)]
   |                        ^^^^^^^^^
   |
   = help: message: proc_macro::__internal::with_parse_sess() called before set_parse_sess()!

error: Could not compile `librespot`.

Sorry if there's an obvious problem here as I'm not proficient in Rust :)

airdrummingfool commented 7 years ago

I had a similar issue, and was able to fix it by removing the homebrew-installed rust I was using and switching to rustup. I'm not sure what the issue is, but apparently the homebrew version causes some builds to fail.

I am running the same versions of rustc and cargo as you (installed with rustup) and am able to compile current master with no issues.

Related: https://github.com/serde-rs/serde/issues/764

donholly commented 7 years ago

That did the trick! Thanks for the quick reply 👍 😄

herrernst commented 7 years ago

FYI, got the same error using Rust 1.17.0 from Homebrew on macOS 10.11.

sashahilton00 commented 7 years ago

This issue is documented on the rust repo here: https://github.com/rust-lang/rust/issues/39870#issuecomment-280216673, was patched here: https://github.com/Homebrew/brew/pull/2036, then subsequently reverted here: https://github.com/Homebrew/brew/pull/2450. In short, Homebrew isn't going to patch the behaviour that causes this issue as it is inconvenient for the vast majority of other packages. So the solution is thus: use rustup. It's better in this instance anyway :) I'll submit a PR for the Readme to make note of this.

herrernst commented 7 years ago

Thanks for the background info and the pull request explaining it in the README.

sashahilton00 commented 7 years ago

No problem :)

ilovezfs commented 7 years ago

This should no longer be a problem in Homebrew due to https://github.com/Homebrew/homebrew-core/pull/14490.