2

When I execute the following command in the Rails project folder:

gem install bson_ext

I get the this error:

#result
Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
    ERROR: Failed to build gem native extension.

    /home/absolute/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for asprintf()... yes
checking for ruby/st.h... yes
checking for ruby/regex.h... yes
checking for ruby/encoding.h... yes
creating Makefile

make
compiling bson_buffer.c
compiling cbson.c
cbson.c: In function ‘write_element’:
cbson.c:439:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-    after-statement]
cbson.c: In function ‘write_doc’:
cbson.c:608:5: warning: implicit declaration of function ‘bson_buffer_get_max_size’     [-Wimplicit-function-declaration]
cbson.c: In function ‘objectid_generate’:
cbson.c:911:9: warning: implicit declaration of function ‘htonl’ [-Wimplicit-function-declaration]
cbson.c:919:5: warning: implicit declaration of function ‘htons’ [-Wimplicit-function-declaration]
compiling encoding_helpers.c
linking shared-object bson_ext/cbson.so

make install
/bin/install -c -m 0755 cbson.so /home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/bson_ext
make: /bin/install: Command not found
make: *** [/home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/bson_ext/cbson.so] Error 127


Gem files will remain installed in /home/absolute/.rvm/gems/ruby-1.9.3- p0/gems/bson_ext-1.6.2 for inspection.
Results logged to /home/absolute/.rvm/gems/ruby-1.9.3-p0/gems/bson_ext-1.6.2/ext/cbson/gem_make.out

I am using mongoid in my Rails project. Installing the bson_ext gem, it gives me the above error.

Can anybody tell me what is the problem?

Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137
aash
  • 1,323
  • 1
  • 14
  • 22
  • What does `which install` say? */usr/bin/install*? -- What about `echo $PATH`? – Samy Dindane May 17 '12 at 08:35
  • yes...which install gives me what you said....and echo $PATH gives: /home/absolute/.rvm/gems/ruby-1.9.3-p0/bin:/home/absolute/.rvm/gems/ruby-1.9.3-p0@global/bin:/home/absolute/.rvm/rubies/ruby-1.9.3-p0/bin:/home/absolute/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl:/opt/java/bin:/opt/java/db/bin – aash May 17 '12 at 08:43

2 Answers2

2

If you are using bundle install, you will need to run

bundle config build.bson_ext --with-cflags="-Wno-error=implicit-function-declaration"
1

Not sure why your make is not using the correct install. But it's easy to do a quick fix:

sudo ln -s /usr/bin/install /bin/install

This will link the existing install into /bin and should enable make to continue.

Casper
  • 33,403
  • 4
  • 84
  • 79