More 1.9.3 fun

Vít Ondruch vondruch at redhat.com
Thu Jan 19 08:16:11 UTC 2012


Hi stahnma,

Thank you for your report and sorry for any inconvenience.

Dne 19.1.2012 01:26, Michael Stahnke napsal(a):
> When installing a gem natively using ruby 1.9.3 package built from the
> github ruby.spec, I'm having trouble using them, specifically with
> bundler.
>
> When I install sqlite3, I get a shared object in
>
> [root at centos6-32 gems]# locate sqlite3_native.so
> /usr/local/lib/gems/exts/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.so
> /usr/local/share/gems/gems/sqlite3-1.3.5/ext/sqlite3/sqlite3_native.so
>
> It seems odd that the lib dir and the gems dir are not the same.  That
> may not be the issue though.

This is by design. Since share should contain just platform independent 
code, the *.so should not be there. The library in ext subfolder is just 
rest of the build process, which is not cleaned up by RubyGems and it is 
not actively used. This folder would not be part of the RPM package. In 
previous Ruby versions, such library would be placed into Ruby's 
site_lib folder.

>
> When I install via bundler (forgive my ignorance here, I normally
> avoid bundler, but for this application it was required).
>
> bundle install  --without development test
>
>
> [root at centos6-32 gitlabhq]# bundle show sqlite3
> /usr/local/share/gems/gems/sqlite3-1.3.4
> [root at centos6-32 gitlabhq]# bundle exec rake -T
> rake aborted!
> cannot load such file -- sqlite3/sqlite3_native
>
> (See full trace by running task with --trace)
> [root at centos6-32 gitlabhq]# bundle exec rake -T --trace
> rake aborted!
> cannot load such file -- sqlite3/sqlite3_native
> /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in `require'
> /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in `rescue
> in<top (required)>'
> /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:2:in `<top (required)>'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
> `block (2 levels) in require'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in
> `block in require'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
> /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
> /srv/gitlabhq/config/application.rb:7:in `<top (required)>'
> /srv/gitlabhq/Rakefile:5:in `require'
> /srv/gitlabhq/Rakefile:5:in `<top (required)>'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:501:in
> `raw_load_rakefile'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block
> in load_rakefile'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
> `standard_exception_handling'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
> `standard_exception_handling'
> /usr/share/gems/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
> /usr/bin/rake:32:in `<main>'
>
>
> [root at centos6-32 gitlabhq]# bundle console
> /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in
> `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
> 	from /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:6:in
> `rescue in<top (required)>'
> 	from /usr/local/share/gems/gems/sqlite3-1.3.4/lib/sqlite3.rb:2:in
> `<top (required)>'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
> `require'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in
> `block (2 levels) in require'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in
> `each'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in
> `block in require'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in
> `each'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in
> `require'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/cli.rb:430:in
> `console'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in
> `run'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in
> `invoke_task'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in
> `dispatch'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in
> `start'
> 	from /usr/local/share/gems/gems/bundler-1.0.21/bin/bundle:13:in `<top
> (required)>'
> 	from /usr/local/bin/bundle:19:in `load'
> 	from /usr/local/bin/bundle:19:in `<main>'
>
>
> So, obviously the bundle can't find the C extension.  According to
> some research, I see this on rubygems.org
>
> "This works because rubygems copies the shared object from ext to lib
> when the gem is installed."
>
> I'm not sure that's happening.

Actually that's happening, just a bit differently. You see that you have 
the 
'/usr/local/lib/gems/exts/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.so' 
so it is in libs and if you run "$ ruby -r sqlite3 -e "puts 'it 
works'"", RubyGems should prepare the load paths and everything should work.

Unfortunately Bundler does not use RubyGems to prepare the load paths 
and it is doing everything by itself. Therefore Bundler doesn't know 
about this modifications we made to RubyGems and cannot load the library 
properly. Moreover, Bundler replace the RubyGems modified 'require' by 
the Ruby's original version, so RubyGems cannot help here.

We are looking into Bundler now to find a cure. Unfortunately, that 
means you will not be able to use stock Bundler in Fedora anymore. The 
only option is to push the RubyGems modifications upstream [1], and 
later push the changes into Bundler's upstream. However, RubyGems 
upstream is not very responsive in this matter. May be you can try to 
support us a bit.


BTW It seems that you are using root for installing the gems. If you 
install the gems by regular user, they will get installed into your home 
and since there is no distinction between platform specific and non 
specific files (i.e. the default gem structure is preserver), you should 
be able to run your application successfully.


Vit



[1] https://github.com/rubygems/rubygems/issues/210


>
>
> I may be completely wrong with that I am doing here as well. The new
> layout of gems in the 1.9 paradigm is still a bit confusing to me, so
> that's why I am suspecting it is the issue. It potentially could be
> the application (http://gitlabhq.com) as well.
>
> Any help would be welcome.
> _______________________________________________
> ruby-sig mailing list
> ruby-sig at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/ruby-sig




More information about the ruby-sig mailing list