Subject: [ruby-ffi] Re: `ffi_libraries': no library specified (LoadError) |
From: quanta |
Date: 4/29/11 12:28 AM |
To: Jesús García Sáez <blaxter@gmail.com> |
CC: ruby-ffi@googlegroups.com |
Hi, I got the same problem when install and run tyrantmanager: http://copiousfreetime.rubyforge.org/tyrantmanager/ # tyrantmanager setup /data/tyrant /usr/lib64/ruby/gems/1.8/gems/loquacious-1.6.4/lib/loquacious/ undefined.rb:87: warning: parenthesize argument(s) for future version /usr/lib64/ruby/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:79:in `ffi_libraries': no library specified (LoadError) from /usr/lib64/ruby/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb: 106:in `attfunc' from /usr/lib64/ruby/gems/1.8/gems/rufus-tokyo-1.0.7/lib/rufus/tokyo/ tyrant/lib.rb:59 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib64/ruby/gems/1.8/gems/rufus-tokyo-1.0.7/lib/rufus/tokyo/ tyrant.rb:32 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib64/ruby/gems/1.8/gems/tyrantmanager-1.6.0/lib/ tyrant_manager/tyrant_instance.rb:2 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib64/ruby/gems/1.8/gems/tyrantmanager-1.6.0/lib/ tyrant_manager.rb:249 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib64/ruby/gems/1.8/gems/tyrantmanager-1.6.0/bin/ tyrantmanager:9 from /usr/bin/tyrantmanager:19:in `load' from /usr/bin/tyrantmanager:19 The content of library.rb from beginning to line 79: module FFI CURRENT_PROCESS = USE_THIS_PROCESS_AS_LIBRARY = Object.new module Library CURRENT_PROCESS = FFI::CURRENT_PROCESS LIBC = FFI::Platform::LIBC def self.extended(mod) raise RuntimeError.new("must only be extended by module") unless mod.kind_of?(Module) end def ffi_lib(*names) ffi_libs = names.map do|name|
if name == FFI::CURRENT_PROCESS FFI::DynamicLibrary.open(nil, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL) else libnames = (name.is_a?(::Array) ? name : [ name ]).map {|n|
[ n, FFI.map_library_name(n) ].uniq }.flatten.compact lib = nil errors = {} libnames.each do|libname|
begin lib = FFI::DynamicLibrary.open(libname, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL) break if lib rescue Exception => ex errors[libname] = ex end end if lib.nil? raise LoadError.new(errors.values.join('. ')) end # return the found lib lib end end @ffi_libs = ffi_libs end def ffi_convention(convention) @ffi_convention = convention end def ffi_libraries raise LoadError.new("no library specified") if !defined? (@ffi_libs) || @ffi_libs.empty? @ffi_libs end I'm not familiar with Ruby. Where should I put "ffi_lib LIBC" in this file? On Feb 19 2010, 4:11 pm, Jesús García Sáez <blax...@gmail.com> wrote:
<wmeiss...@gmail.com> wrote:On Thu, Feb 18, 2010 at 20:45, Wayne Meissner<blax...@gmail.com>:2010/2/19 Jesús García Sáez
Obviously it fails telling you there isnolibspecified, the hello world I see in github is this [0], where did you get that example?
Its probably in an example on the wiki somewhere. Anyone who feels like jumping in and fixing up the examples to specify a lib, feel free.You were right, I fixed it. Stefan, just put "ffi_lib LIBC" (or FFI::Platform::LIBC in jruby, 'cause jruby's ffi is a bit outdated) and there you go.