Subject:
[ruby-ffi] invalid ELF header on hello world example
From:
bwv549
Date:
5/26/10 6:09 PM
To:
ruby-ffi

---
require 'ffi'

LIBC = 'libc'
module Hello
  extend FFI::Library
  ffi_lib LIBC
  attach_function 'puts', [ :string ], :int
end

Hello.puts("Hello, World")
---

Gives me:
/home/jtprince/.gem/ruby/1.9.1/gems/ffi-0.6.3/lib/ffi/library.rb:61:in
`block in ffi_lib': Could not open library 'libc': libc: cannot open
shared object file: No such file or directory. Could not open library
'libc.so': /usr/lib/libc.so: invalid ELF header (LoadError)
	from /home/jtprince/.gem/ruby/1.9.1/gems/ffi-0.6.3/lib/ffi/library.rb:
43:in `map'
	from /home/jtprince/.gem/ruby/1.9.1/gems/ffi-0.6.3/lib/ffi/library.rb:
43:in `ffi_lib'
	from hello.rb:7:in `<module:Hello>'
	from hello.rb:5:in `<main>'

Seems like it can see libc but says "invalid ELF header".  How do I
get hello world to run on linux?