ffi library refuses to load

  • Thread starter Luther Thompson
  • Start date
L

Luther Thompson

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.
 
R

Ryan Davis

<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)

Just a guess, I think this is saying libffi.so.4 is missing, not ffi_c.so.
 
L

Luther Thompson

Is there any way to confirm that? And if it's true, how can I fix it?
And why doesn't 'gem install' catch the error?
 
A

Ammar Ali

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 http://sourceware.org/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
 
L

Luther Thompson

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 http://sourceware.org/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!
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.

Thanks again...
Luther
 
A

Ammar Ali

Then, I remembered to do 'sudo gem pristine ffi', and now it *does*
work!


Trisquel is based on Ubuntu. I do have a pkg-config command.

Thanks again...

You're welcome. Trisquel sounds interesting, I'd never heard of it before.

Regards,
Ammar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top