I'm trying to run a sample program from rubygame, but it claims a
library file from ffi is missing. From my terminal:
luther@hrimfaxi:/usr/local/lib/ruby/gems/1.9.1/gems$
./rubygame-2.6.4/samples/demo_rubygame.rb
<internal:lib/rubygems/custom_require>:29:in `require': libffi.so.4:
cannot open shared object file: No such file or directory -
/usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.0/lib/ffi_c.so (LoadError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.0/lib/ffi.rb:8:in
`rescue in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.0/lib/ffi.rb:1:in
`<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from
/usr/local/lib/ruby/gems/1.9.1/gems/nice-ffi-0.4/lib/nice-ffi.rb:31:in
`<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from
/usr/local/lib/ruby/gems/1.9.1/gems/ruby-sdl-ffi-0.3/lib/ruby-sdl-ffi/sdl.rb:31:in
`<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from
/usr/local/lib/ruby/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame/main.rb:22:in
`<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from
/usr/local/lib/ruby/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame.rb:44:in
`block in <top (required)>'
from
/usr/local/lib/ruby/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame.rb:29:in
`each'
from
/usr/local/lib/ruby/gems/1.9.1/gems/rubygame-2.6.4/lib/rubygame.rb:29:in
`<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from ./rubygame-2.6.4/samples/demo_rubygame.rb:25:in `<main>'
luther@hrimfaxi:/usr/local/lib/ruby/gems/1.9.1/gems$ ll
ffi-1.0.0/lib/ffi_c.so
-rwxr-xr-x 1 root root 525k 2010-12-02 Thu 20:39:04
ffi-1.0.0/lib/ffi_c.so
As you can see from the ll command at the bottom, the file is most
definitely there. This is very frustrating. Any ideas?
I'm using 'ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]',
compiled from source, on Trisquel 4.
Just a guess, I think this is saying libffi.so.4 is missing, not ffi_c.so.
···
On Dec 2, 2010, at 21:11 , Luther Thompson wrote:
<internal:lib/rubygems/custom_require>:29:in `require': libffi.so.4:
cannot open shared object file: No such file or directory -
/usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.0/lib/ffi_c.so (LoadError)
Is there any way to confirm that? And if it's true, how can I fix it?
Try:
$ locate libffi
If it's not found, then either use your system's package manager to
install it, or grab the source from libffi and
compile/install it yourself.
And why doesn't 'gem install' catch the error?
The gem checks for the library (via pkg-config) and for the required
development header. I'm not familiar with Trisquel, perhaps it uses
different conventions that are not covered/tested by the gem.
HTH,
Ammar
···
On Fri, Dec 3, 2010 at 5:25 PM, Luther Thompson <lutheroto@gmail.com> wrote:
It works now. Thanks a lot for the help. Details below.
Ammar Ali wrote in post #965991:
Try:
$ locate libffi
That showed me two files which, in my uninformed opinion, should have
been valid:
/usr/lib/libffi.so.5
/usr/local/lib64/libffi.so.4
If it's not found, then either use your system's package manager to
install it, or grab the source from libffi and
compile/install it yourself.
In Synaptic, I installed libffi-dev. Then I did 'sudo gem pristine ffi'.
Running demo_rubygame.rb still gave me the same error.
Then, I installed libffi from source. Still the same error.
Then, I remembered to do 'sudo gem pristine ffi', and now it *does*
work!
And why doesn't 'gem install' catch the error?
The gem checks for the library (via pkg-config) and for the required
development header. I'm not familiar with Trisquel, perhaps it uses
different conventions that are not covered/tested by the gem.
Trisquel is based on Ubuntu. I do have a pkg-config command.
You're welcome. Trisquel sounds interesting, I'd never heard of it before.
Regards,
Ammar
···
On Fri, Dec 3, 2010 at 8:57 PM, Luther Thompson <lutheroto@gmail.com> wrote:
Then, I remembered to do 'sudo gem pristine ffi', and now it *does*
work!
And why doesn't 'gem install' catch the error?
The gem checks for the library (via pkg-config) and for the required
development header. I'm not familiar with Trisquel, perhaps it uses
different conventions that are not covered/tested by the gem.
Trisquel is based on Ubuntu. I do have a pkg-config command.