0

I am getting the following error while run bundle install after adding the gem 'mongoid', '2.0.0.beta.19' and gem 'bson_ext' .

Error:

 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.

    C:/Ruby193/bin/ruby.exe extconf.rb
checking for asprintf()... no
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile

make
generating cbson-i386-mingw32.def
compiling bson_buffer.c
compiling cbson.c
cbson.c:25:23: fatal error: arpa/inet.h: No such file or directory
compilation terminated.
make: *** [cbson.o] Error 1


Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/bson_ext-
1.12.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/bson_ext-1.12.1/ext/cbson/
gem_make.out
An error occurred while installing bson_ext (1.12.1), and Bundler cannot
continue.
Make sure that `gem install bson_ext -v '1.12.1'` succeeds before bundling.

Error-2:

C:\Site\mongo_blog>gem install bson_ext -v '1.12.1'
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe -r ./siteconf20150414-3752-177v4w2.rb extconf.rb
checking for asprintf()... no
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/bson_ext-
1.12.1 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/bs
on_ext-1.12.1/gem_make.out

My Gemfile is as follows.

Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.19'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
gem 'mongoid', '2.0.0.beta.19'
gem 'bson_ext'

Please help me resolve this error.

rajat_474
  • 346
  • 1
  • 4
  • 15

1 Answers1

0

As the error reads:

Make sure that gem install bson_ext -v '1.12.1' succeeds before bundling.

Installing bson_ext is causing issue. Try updating rubygems and then try again:

gem update --system
gem install bson_ext -v '1.12.1'
bundle install
shivam
  • 16,048
  • 3
  • 56
  • 71
  • Hi,shivam first I run your first option .When i run gem install bson_ext -v '1.12.1' again it gave me some error which has added in my question part as error-2. – rajat_474 Apr 13 '15 at 10:27
  • @rajat_474 I just realized you are on Windows. Check [this](http://stackoverflow.com/a/26370764/3035830), should help. – shivam Apr 13 '15 at 10:29