lxc / ruby-lxc

ruby bindings for liblxc
https://linuxcontainers.org/lxc
GNU Lesser General Public License v2.1
133 stars 29 forks source link

lxc.so is put in lib rather than lib/lxc #4

Closed jeremiahsnapp closed 10 years ago

jeremiahsnapp commented 10 years ago

When I build and install this gem I can't use it unless I move the lxc.so into the installed gem's lib/lxc directory. Is there something I'm doing wrong? I've tried this with ruby 2.1.0 and ruby 1.9.3p448.

git clone ...
cd ruby-lxc
gem build ruby-lxc.gemspec
gem install ruby-lxc-0.1.0.gem

This is what requiring it looks like for me.

irb(main):001:0> require 'lxc'
LoadError: cannot load such file -- lxc/lxc
    from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc.rb:2:in `<top (required)>'
    from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
    from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
    from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from (irb):1
    from /opt/rubies/ruby-2.1.0/bin/irb:11:in `<main>'
irb(main):002:0>

Moving the .so file works but why?!

mv /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc.so /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc/

rb(main):001:0> require 'lxc'
=> true
irb(main):002:0>
ranjib commented 10 years ago

i am getting this as well. strangely this does not occur if i do bundle exec irb and then require lxc from there, as it is, without moving the .so file

On Fri, Jan 3, 2014 at 1:19 PM, Jeremiah Snapp notifications@github.comwrote:

When I build and install this gem I can't use it unless I move the lxc.so into the installed gem's lib/lxc directory. Is there something I'm doing wrong? I've tried this with ruby 2.1.0 and ruby 1.9.3p448.

git clone ... cd ruby-lxc gem build ruby-lxc.gemspec gem install ruby-lxc-0.1.0.gem

This is what requiring it looks like for me.

irb(main):001:0> require 'lxc' LoadError: cannot load such file -- lxc/lxc from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc.rb:2:in <top (required)>' from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:inrequire' from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in rescue in require' from /opt/rubies/ruby-2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:inrequire' from (irb):1 from /opt/rubies/ruby-2.1.0/bin/irb:11:in `

' irb(main):002:0>

Moving the .so file works but why?!

mv /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc.so /opt/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/ruby-lxc-0.1.0/lib/lxc/

rb(main):001:0> require 'lxc' => true irb(main):002:0>

— Reply to this email directly or view it on GitHubhttps://github.com/lxc/ruby-lxc/issues/4 .

jeremiahsnapp commented 10 years ago

I'm not real familiar with how these things are supposed to work. Is there something wrong with what I'm doing? I shouldn't have to use bundler right?

ranjib commented 10 years ago

yeah , you dont have to. i just mentioned it to help with debugging. may be we need to add lib path in the gemspec. but im not sure

ranjib commented 10 years ago

@jeremiahsnapp can you test this patch

jeremiahsnapp commented 10 years ago

Thanks @ranjib and @andrenth! That patch works for me too. I really appreciate how quickly you respond to these issues.