Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Patch for installing bson_ext gem on ruby-2.0.0-p0 #178

Closed
wants to merge 2 commits into from

2 participants

@eranb

Hi,
I had some issues installing the bson_ext gem on ruby-2.0.0-p0, as originally reported @ RUBY-561.

The thing is that even when I tried to install it on rubygems-2.0.3 ( suggested as a workaround in the ticket ) it still didn't load properly.

➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin11.4.2]
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ gem --version
2.0.3
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ gem install bson_ext
Building native extensions.  This could take a while...
Successfully installed bson_ext-1.8.3
Parsing documentation for bson_ext-1.8.3
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/bson_ext/bson_ext, skipping
Done installing documentation for bson_ext (0 sec).
1 gem installed
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ ruby -e "require 'bson';require 'bson_ext/cbson'"
      ** Notice: The native BSON extension was not loaded. **

      For optimal performance, use of the BSON extension is recommended.

      To enable the extension make sure ENV['BSON_EXT_DISABLED'] is not set
      and run the following command:

        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.
/Users/eran/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- bson_ext/cbson (LoadError)
    from /Users/eran/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
    from -e:1:in `<main>'

After applying the patch

➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ gem build bson_ext.gemspec
WARNING:  licenses is empty
  Successfully built RubyGem
  Name: bson_ext
  Version: 1.8.3
  File: bson_ext-1.8.3.gem
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ gem install bson_ext-1.8.3.gem 
Building native extensions.  This could take a while...
Successfully installed bson_ext-1.8.3
Parsing documentation for bson_ext-1.8.3
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for ext/bson_ext/bson_ext, skipping
Done installing documentation for bson_ext (0 sec).
1 gem installed
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ ruby -e "require 'bson';require 'bson_ext/cbson'"
➜  mongo-ruby-driver rvm:(ruby-2.0.0) git:(master) ✗ 

I thought that this patch could be useful or even just as a reference to another workaround to the issue

@brandonblack

Hmmm. I haven't observed or heard any other reports of this still being an issue after the bug was fixed in Rubygems 2.0.0+. Even if they have regressed in a later version, I'm not sure it makes sense for us to try and patch around a legit bug on their end. That would likely just lead to another break later when they fix it.

I'll confirm in a little while if this issue is present again on rubygems 2.0.3.

@eranb

couldn't agree more with you, I originally thought that the issue is somehow related to mkfk.rb that ships with the stdlib , but it's not the case, as it was strange that no one complained about it.

That's why I reinstalled rubygems and checked it again, and it's seems to be working now :smile:
so it was an issue with my configuration after all.

Thanks for your reply and sorry for the mess
Have a great week

@eranb eranb closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 19, 2013
  1. @eranb
  2. @eranb

    Patch only ruby-2.0.0-p0

    eranb authored
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 ext/cbson/extconf.rb
View
8 ext/cbson/extconf.rb
@@ -7,4 +7,10 @@
have_header("ruby/encoding.h")
dir_config('cbson')
-create_makefile('bson_ext/cbson')
+
+if "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}".eql? '2.0.0-p0'
+ FileUtils.mkdir "../bson_ext/bson_ext"
+ create_makefile('bson_ext/cbson')
+else
+ create_makefile('bson_ext/bson_ext')
+end
Something went wrong with that request. Please try again.