Burgestrand / spotify

Low-level Ruby bindings for libspotify, the official Spotify C API
https://rubygems.org/gems/spotify
Other
147 stars 17 forks source link

Raspberry Pi Hard Float libspotify #12

Closed bradleyjones closed 11 years ago

bradleyjones commented 11 years ago

Spotify have released a beta binary of libspotify for the armv6 with hard float support trying to use hallon throws this error

pi@raspberrypi:~$ ruby test.rb /home/pi/.rvm/gems/ruby-1.9.3-p385/gems/spotify-12.3.0/lib/spotify/api.rb:43:in <module:Spotify>': libspotify v12.1.103.gd51f6226 Release Linux-armv6-bcm2708hardfp is incompatible with ruby spotify v12.3.0(12.1.51) (LoadError) from /home/pi/.rvm/gems/ruby-1.9.3-p385/gems/spotify-12.3.0/lib/spotify/api.rb:1:in<top (required)>' from /home/pi/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require' from /home/pi/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from /home/pi/.rvm/gems/ruby-1.9.3-p385/gems/spotify-12.3.0/lib/spotify.rb:112:in <top (required)>' from /home/pi/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:inrequire' from /home/pi/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in rescue in require' from /home/pi/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:inrequire' from test.rb:4:in `

'

Will there be support for this hard float version of libspotify or do I need to use a soft float os and install a different version of libspotify?

Burgestrand commented 11 years ago

I actually have a raspberry pi nowadays, which means I can try it out. I don’t know if rubygems has support for detecting hard floats or not (which would be required), but I’ll let ruby compile during the night and have a look in the morning to see if I can figure something out.

bradleyjones commented 11 years ago

Much appreciated look forward to hearing your findings

Burgestrand commented 11 years ago

I’ve looked around some on the hard float distribution. Need to take a look at the soft float raspbian (and possibly arch) to see if rubygems can differ between them. Will compile ruby again on this soft float distribution (.__.) while I’m at work, and see again in about 10 hours.

Burgestrand commented 11 years ago

I can’t see a noticeable difference between armel/armhf on rubygems; I’m not sure rubygems even support targeting the two separately. If it doesn’t, there is no easy way for me to supply a gem for just one of them.

It also complicates things that libspotify released the 12.1.103 only for armv6hf, and no 12.1.103 for the other platforms. If I release a new version of libspotify/spotify gem that supports 12.1.103, I have to careful not to break the other versions accidentally with some weird installation hack because of the (supposed) lack of rubygems support.

I’ve created a question for the rubygems.org team, perhaps they can provide me with some insight: http://help.rubygems.org/discussions/questions/3159-how-to-target-armhf-vs-armel-eg-different-oss-on-raspberry-pi?unresolve=true

bradleyjones commented 11 years ago

In the meantime so I can try and get stuck into some dev using this library on the Pi what would the best install be, soft float raspbian and just install the gem or will I also need to manually compile the libspotify library?

Burgestrand commented 11 years ago

Yes. To run Hallon/spotify gem on raspberry pi you’ll need a soft float OS, and you will also need to install libspotify yourself. I’ve supplied instructions in the past that should work: https://github.com/Burgestrand/Hallon/wiki/How-to-install-libspotify

There is nothing to compile. Just download the libspotify binary and put in the correct path on your system. The rest should work. I’m following the instructions myself at the moment to see if they work, but it takes a while to compile/install the gems on the raspberry pi. :)

bradleyjones commented 11 years ago

It does indeed take a long time to compile/install gems on the pi :(

Which version of libspotify would you recommend from my research it looked like there were previously some issues with armv6 https://github.com/Burgestrand/libspotify/issues/1 so should I go straight to using the armv5 version?

Burgestrand commented 11 years ago

Yes, considering that, using v5 might not be a bad idea, if it works. I was planning on using v6, just to see what happens.

bradleyjones commented 11 years ago

Had some time to play around I found that the v6 version of libspotify works fine with soft float raspbian wheezy

Burgestrand commented 11 years ago

I’m surprised you got it working at all! In my experiments, I’ve found libspotify on ARM (i.e. raspberry pi) crashes somewhat randomly on perfectly valid code. There appears to be some bug in libspotify on ARM platforms that is especially visible when using memory allocated in the way ruby ffi must allocate it.

Here are my experiments: https://gist.github.com/Burgestrand/7b691591af20c29d6849

Anyhow, back to this issue: rubygems can’t differ between soft and hard float, and neither can ruby. There are ways one could figure out which platform is running during runtime, which means I could create a rubygem which contain libspotify for both float supports, and point to the correct one when booting ruby.

However, given that hard float libspotify is a different version from all other releases, I’ll only support soft float for now until the other platforms of libspotify catches up.