[RUBY-561] bson_ext C extension not activated after upgrading to bundler 1.3.0 and Ruby 2.0.0 Created: 25/Feb/13  Updated: 12/Jan/17  Resolved: 06/Mar/13

Status: Closed
Project: Ruby Driver
Component/s: None
Affects Version/s: 1.6.1
Fix Version/s: 12_01_17

Type: Bug Priority: Major - P3
Reporter: Fredrik Björk Assignee: Brandon Black (Inactive)
Resolution: Fixed Votes: 0
Labels: None

# Replies: 12
Participants:
Days since reply: 4 years, 51 weeks, 3 days ago
Date of 1st Reply:
Last commenter: Rathi Gnanasekaran
Last comment by Customer: true

 Description   

After upgrading to Ruby 2.0.0, bundler 1.3.0 and rubygems 2.0.0 I get the following warning when I start my Rails 3 app:

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
You can install the extension as follows:
gem install bson_ext
If you continue to receive this message after installing, make sure that the
bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.



 Comments   
Comment by Tyler Brock (Inactive) [ 25/Feb/13 ]

Have you tried running bundle update?

Comment by Fredrik Björk [ 25/Feb/13 ]

Yeah, same warning happens after bundle update.

Comment by Tyler Brock (Inactive) [ 25/Feb/13 ]

bundle install bson_ext? I'm assuming its installed right?

Comment by Fredrik Björk [ 25/Feb/13 ]

Yeah it's installed correctly, but for some reason it's not activated. Must have something to do with rubygems 2.0.0, ruby 2.0.0 or bundler 1.3.0

Comment by Rodrigo Rosenfeld Rosas [ 26/Feb/13 ]

I can confirm the issue. Try this:

gem install bson_ext -v 1.8.2

2.0.0-p0 :003 > require 'bson_ext'
LoadError: cannot load such file – bson_ext
from (irb):3:in `require'
from (irb):3
from /home/rodrigo/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `<main>'

The mongo gem will actually try to run 'bson_ext/cbson':

> gem 'bson_ext'
> require 'bson_ext/cbson'
LoadError: cannot load such file – bson_ext/cbson
from /home/rodrigo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/rodrigo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from (irb):1
from /home/rodrigo/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `<main>'

Comment by Rodrigo Rosenfeld Rosas [ 26/Feb/13 ]

I'd just like to notice that you can "require 'bson'" in irb from a git checkout of the sources. It just doesn't works when installed through rubygems 2.

Comment by Rodrigo Rosenfeld Rosas [ 26/Feb/13 ]

I've been doing some experiments. If you change s.require_paths in bson_ext.gemspec from ['ext/bson_ext'] to ['ext'] and try to require 'cbson/cbson' then it will work. I believe you expected 'cbson.so' to be packaged under 'ext/bson_ext' but it doesn't seem to work this way with RubyGems 2.

Comment by Rodrigo Rosenfeld Rosas [ 26/Feb/13 ]

Ah, when I look at the extracted gem fro 1.9.3 I see that there is a ext/bson_ext/cbson.so while for 2.0.0 the ".so" extension is missing. I diffed it against cbson.so and it is the same file, just missing the extension. Any ideas why?

Comment by Rodrigo Rosenfeld Rosas [ 26/Feb/13 ]

I've also created a ticket in ruby-lang: https://bugs.ruby-lang.org/issues/7971

Comment by Brandon Black (Inactive) [ 06/Mar/13 ]

This issue was resolved in today's update of rubygems version 2.0.2 and I just confirmed that locally. However, you'll need to re-install the gem before the fix will take effect.

gem update --system
gem install bson_ext

Comment by Rodrigo Rosenfeld Rosas [ 06/Mar/13 ]

Thank you for looking into this, Brandon. It worked here as well and that annoying message went away finally

Comment by Brandon Black (Inactive) [ 07/Mar/13 ]

Awesome. Great to hear. It was driving me crazy too

Generated at Sun Feb 25 13:17:28 UTC 2018 using JIRA 7.2.10#72012-sha1:2651463a07e52d81c0fcf01da710ca333fcb42bc.