Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open shared object #25

Open
MarioRuiz opened this issue Apr 6, 2021 · 8 comments
Open

Cannot open shared object #25

MarioRuiz opened this issue Apr 6, 2021 · 8 comments

Comments

@MarioRuiz
Copy link

Getting next error on a rpi 3B+

	5: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
	3: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
	2: from /var/lib/gems/2.5.0/gems/rpi_gpio-0.5.0/lib/rpi_gpio.rb:1:in `<top (required)>'
	1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': libruby.so.2.7: cannot open shared object file: No such file or directory - /var/lib/gems/2.5.0/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so (LoadError)
@repent
Copy link

repent commented Apr 15, 2021

@MarioRuiz I think this might be a duplicate of #22

Before getting into that thread though, check that your user is a member of the gpio group.

@synthead
Copy link

I'm running into the same problem:

[1] pry(main)> require "rpi_gpio"
LoadError: libruby.so.2.7: cannot open shared object file: No such file or directory - /home/deploy/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so
from <internal:/home/deploy/.rbenv/versions/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
Caused by LoadError: cannot load such file -- rpi_gpio
from <internal:/home/deploy/.rbenv/versions/3.0.2/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'

The "deploy" user has access to the gpio stuff.

@martini
Copy link

martini commented Dec 28, 2021

I have the same issue here, rpi 3B+, ruby-2.6.6, rpi_gpio-0.5.0

pi@pi:~/sensor-tools $ irb 
2.6.6 :001 > require 'rpi_gpio'
Traceback (most recent call last):
       10: from /home/pi/.rvm/rubies/ruby-2.6.6/bin/irb:23:in `<main>'
        9: from /home/pi/.rvm/rubies/ruby-2.6.6/bin/irb:23:in `load'
        8: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        7: from (irb):1
        6: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
        5: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
        4: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:130:in `require'
        3: from /home/pi/.rvm/gems/ruby-2.6.6/gems/rpi_gpio-0.5.0/lib/rpi_gpio.rb:1:in `<top (required)>'
        2: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        1: from /home/pi/.rvm/rubies/ruby-2.6.6/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
LoadError (libruby.so.2.7: cannot open shared object file: No such file or directory - /home/pi/.rvm/gems/ruby-2.6.6/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so)
2.6.6 :002 > 

pi@pi:~/sensor-tools $ ls -l /home/pi/.rvm/gems/ruby-2.6.6/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so
-rwxr-xr-x 1 pi pi 128252 Dec 28 00:38 /home/pi/.rvm/gems/ruby-2.6.6/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so
pi@pi:~/sensor-tools $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),117(lpadmin),997(gpio),998(i2c),999(spi)
pi@pi:~/sensor-tools $ 

So it is no permission issue. Any other ideas?

@bjscheue
Copy link

bjscheue commented Mar 21, 2022

I'm running into the same trouble here. After moving to a newer version of Raspberry Pi OS (on the same hardware), my Ruby code with rpi_gpio stopped working. Ruby 2.7.4p191 here, on a RPi 3B+.

The gem installation works without errors. require-ing the gem then fails with "cannot open shared object file: No such file or directory", even though rpi_gpio.so exists under exactly the path stated in the error message. Exactly as for @martini above. Running as root doesn't make a difference.

Has anyone made progress in that regard already? Any hints?

(Edited: It's actually a RPi 3B+, not a RPi 4 as stated in my original post. I have too many RPis, it appears, if it's getting so difficult to tell them apart. Shame on me. ;-P )

@tubsandcans
Copy link

It really is a shame there is no way to work around this issue and we're getting nothing but the sound of crickets from the maintainer...

Looks like I'll have to use the go gpio port to generate an executable to perform the gpio stuff and call that from my Ruby program. Super annoying.

@richardpenner
Copy link

Coming into the same issue and noticed that ldd /path/to/rpi_gpio.so reveals a missing dependency:

…
libruby.so.2.7 => not found
…

So maybe it needs Ruby 2.7.0 installed? I'm attempting that and will report back

@richardpenner
Copy link

richardpenner commented May 23, 2022

Yeah that fixes it. For anyone else arriving here from google:

  • the error message above is hard to read, but it's complaining about missing libruby.so.2.7, not the gpio file – that's where it experienced the error.
  • If you run ldd <full-path-to-rpi_gpio.so> you'll see which dependency is missing – in my case it was libruby.so.2.7. I had to not just install Ruby 2.7 but actually use that version (in my case I am using rbenv to manage multiple Ruby installations).

Interestingly I still see the missing file in ldd after installing 2.7, but when I set my Ruby version to 2.7.0 the gpio module works fine.

@softagency
Copy link

In my case, libruby file name was different. so I created symlinks.
Here is how to fix it.

# ldd /var/lib/gems/2.7.0/gems/rpi_gpio-0.5.0/lib/rpi_gpio/rpi_gpio.so
        linux-vdso.so.1 (0x7efc8000)
        /usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76f83000)
        libruby.so.2.7 => not found
        libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76f14000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76dc1000)
        /lib/ld-linux-armhf.so.3 (0x76faf000)
# cd /lib/arm-linux-gnueabihf
# ln -s libruby-2.7.so libruby.so.2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants