halostatue-archive / rubypython

An in-process between Ruby and Python 2.
Other
254 stars 47 forks source link

problem with python2.7 #18

Open halostatue opened 7 years ago

halostatue commented 7 years ago

Hi, I have both python2.6 and python2.7 installed on my system and when trying to use a gem depends on 'rubypython' i got this error "/home/aboelnour/.rvm/gems/ruby-1.9.3-p0/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library '/usr/local/lib/libpython2.7.a': /usr/local/lib/libpython2.7.a: invalid ELF header (LoadError)"

i dig in the rubypython gem code and find this lines in '/lib/rubypython/python.rb':

EXEC = RubyPython::PythonExec.new(RubyPython.options[:python_exe])
PYTHON_LIB = EXEC.library
FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL
ffi_lib_flags :lazy, :global
ffi_lib EXEC.library

and found that EXEC.library points to -> "/usr/local/lib/libpython2.7.a" which is a static library, and as i know 'ffi' gem don't load static libraries but it loads shared objects (dynamic libraries) so i set manually PYTHON_LIB to the dynamic lib path and the issue is solved. thanks.