Issue #7 resolved

libpython fails to load on 64-bit CentOS 5.5

created an issue

While trying to use rubypython 0.5.1 on CentOS 5.5, Ruby 1.8.7 and Python 2.4, I ran into this error - {{{


/home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/ffi-1.0.9/lib/ffi/library.rb:76:in ffi_lib': Could not open library '': cannot open shared object file: No such file or directory (LoadError) from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/ffi-1.0.9/lib/ffi/library.rb:55:inmap' from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/ffi-1.0.9/lib/ffi/library.rb:55:in ffi_lib' from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/rubypython-0.5.1/lib/rubypython/python.rb:31 from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/rubypython-0.5.1/lib/rubypython.rb:261:inload' from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/rubypython-0.5.1/lib/rubypython.rb:261:in reload_library' from /home/amujumdar/.rvm/gems/ruby-1.8.7-p334@ohloh-rails-2.3/gems/rubypython-0.5.1/lib/rubypython.rb:104:instart' }}}

Turned out, 64-bit Python shared libraries are located in /usr/lib64/, which is not one of the paths rubypython looks into.

To fix this error, I added this location to {{{


if FFI::Platform.unix?
  # On Unixes, let's look in some standard alternative places, too.
  # Just in case. Some Unixes don't include a .so symlink when they
  # should, so let's look for the base case of .so.1, too.
  [ libname, "#{libname}.1" ].each do |name|
    locations << File.join("/opt/local/lib", name)
    locations << File.join("/opt/lib", name)
    locations << File.join("/usr/local/lib", name)
    locations << File.join("/usr/lib", name)
    locations << File.join("/usr/lib64", name)

}}} in rubypython-0.5.1/lib/rubypython/pythonexec.rb, find_python_lib method.

Comments (3)

  1. chen qian

    and in my ubuntu 13.10 vmware workstation, the library are located in /usr/lib/python2.7/config-x86_64-linux-gnu/, I think the gem should provide an api to set
    the lib path by myself

  2. Log in to comment