How to target armhf vs. armel (e.g. different OSs on raspberry pi)?
I need to target armel/armhf (soft float vs hard floats) on the
raspberry pi in one of my gems. My gem contains a binary which is
sensitive to hard vs. soft floats. ruby -e 'p
Gem::Platform.local.to_s' reports armv6l-linux on both hard
float and soft float OS. How can I make two gems, one for each of
the two platform differences? How can I figure out which platform
to target through the gem platform option?
If there’s no way, do you have any ideas on how I might approach the problem in another way? I currently fall back to system binary if no platform-specific gem exists, but would really like to have the ease-of-installation that the binary-supplying gem brings.
Some more details:
I have a gem which includes a dynamic library. This library is different per platform (e.g. linux vs mac vs windows), which I currently target specifically. libspotify is the gem in question: https://rubygems.org/gems/libspotify — for non-supported platforms I simply fall back to a no-platform variant, which does not include the binary, and grabs it from system-installed locations (if available).
Now, there is the raspberry pi (http://www.raspberrypi.org/), which in essence is just a tiny computer. libspotify, the binary I supply through my gem, has different binaries depending on if your raspberry pi OS is using hard floats (armhf) or soft floats (armel). However, I’m not sure if rubygems support targeting these two separately, or how I can find it out. This last thing is what I need help with.
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Eric Hodel on 19 Feb, 2013 08:49 PM
Can you attach the rbconfig.rb for each platform?
3 Posted by Kim Burgestrand on 19 Feb, 2013 08:51 PM
Will do. How do I find it?
Support Staff 4 Posted by Eric Hodel on 19 Feb, 2013 08:54 PM
gem which rbconfig5 Posted by Kim Burgestrand on 22 Feb, 2013 06:54 AM
Appears my comments (all five) are getting caught in a moderation filter of sorts.
Support Staff 6 Posted by Eric Hodel on 26 Feb, 2013 12:49 AM
There is no difference between these two files so there is no way for RubyGems to target one or the other.
Ultimately the values in rbconfig.rb come from autoconf. I'm unsure of who to contact to figure out if autoconf knows there is a difference.
If you have some other way of detecting the hardware you're running on you can use extconf.rb to install the correct version along with a platform targeted at arm-linux-gnueabi.
7 Posted by Kim Burgestrand on 27 Feb, 2013 09:14 PM
Looks like I have to fall back on some runtime check. Thanks Eric!
Support Staff 8 Posted by Eric Hodel on 27 Feb, 2013 09:18 PM
You can also package both versions of the shared library in your gem and require the appropriate one at runtime. This technique is known as "fat binary gems":
http://tenderlovemaking.com/2009/05/07/fat-binary-gems-make-the-roc...
Good luck
Support Staff 9 Posted by Eric Hodel on 27 Feb, 2013 09:18 PM
Eric Hodel closed this discussion on 27 Feb, 2013 09:18 PM.
Support Staff 10 Posted by Eric Hodel on 27 Feb, 2013 09:18 PM