plietar / librespot

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

Mention kernel 3.9 is required #226

Open Informatic opened 7 years ago

Informatic commented 7 years ago

Hey, when trying to run a binary built with librespot-cross container on "legacy" (3.4) Allwinner H3 (OrangePi Zero) Linux Kernel I noticed it crashes with "Protocol not available" error when discovery is enabled. Sadly I don't have full error line, as I already resolved it and forgot to write it down.

This error is thrown when calling setsockopt with SO_REUSEPORT, which is only available since Linux Kernel 3.9 AFAIK. It'd be nice to mention it in README, or find some solution to disable that syscall or ignore that error on unsupported systems. I'm not a rust developer myself, so wasn't even able to find a module (crate?) it is actually called in ;)

Besides that everything works perfectly.

bjoerns1983 commented 7 years ago

You saved my day, tried to use librespot on an OrangePi Zero which only has a Legacy Kernel and was wondering we it does not work

bjoerns1983 commented 7 years ago

The complete error line is this: INFO:librespot: librespot ddfc28f (2017-08-04). Built on 2017-08-07. Build ID: N5RcEuis thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: Error { repr: Os { code: 92, message: "Protocol not available" } }', /checkout/src/libcore/result.rs:860 note: Run withRUST_BACKTRACE=1for a backtrace.

@Informatic how did you solve this, i have the same hardware here an would love to have librespot running on it

Informatic commented 7 years ago

I just upraded my box to mainline kernel. I've been using Armbian, so all I needed to do was just install following packages: linux-image-dev-sun8i linux-headers-dev-sun8i linux-u-boot-orangepipc-dev linux-jessie-root-dev-orangepipc linux-dtb-dev-sun8i (keep in mind video and some other minor peripherals are not supported in mainline yet, look this stuff up on Armbian forums, as this is not really a proper place for that...)

djsuszi commented 7 years ago

Can't it be used without SO_REUSEPORT ? new dev kernels can have some issues,

On old kernel it's working with --disable-discovery and registering with user/password.

montvid commented 7 years ago

@herrernst I would like to reopen the problem - It is a big problem for most of the ARM users! Most of ARM users have old kernels like 3.0 and 3.4. I was able to compile librespot fine on armhf 3.4 kernel but I get @bjoerns1983 mentioned error while trying to run librespot with discovery enabled. Please try to change the code to support old ARM devices because I am trying to find a use for old phones with good DAC i.e. samsung galaxy s 2 kernel 3.0, lg g2 3.4 kernel running librespot in linux chroot etc.

jr01 commented 6 years ago

@Informatic - I found that the reuse_port is used in rust-mdns address_family.rs - if I comment out line 15 and cargo build (I am using spotty) on my ARM with kernel 2.6 then discovery works.

montvid commented 6 years ago

Thanks @jr01 for your research. Could you do a code contribution via pull request - maybe this way it would be fixed sooner? :) I love that Librespot is just 12.8MB of ram and spotify is like more than 200MB!

jr01 commented 6 years ago

I could do that, but I am not a rust developer and I am very unsure if the change is correct and what side effects it may have. Maybe @plietar can help?

bjoerns1983 commented 6 years ago

Tried the workaround of jr01 and it works for me, no negative side effects till now. Struggled a bit till i compiled a patched version but i made a guide if somebody also wants to try: Compile Librespot for Orange Pi Asking myself if reuse_port is really neccessary here.

sashahilton00 commented 6 years ago

Issue migrated to librespot-org/issue-test#1