1

I have run the command: gem install bcrypt '3.1.7'.

Unfortunately the gem fails to install. Instead I get the following output:

 Fetching: bcrypt-3.1.7.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
        ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
checking for ruby/util.h... yes
creating Makefile

make
gcc -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_UTIL_H    -fPIC -O2 -fno-tree
-dce -fno-optimize-sibling-calls  -fPIC   -c crypt.c
gcc -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_UTIL_H    -fPIC -O2 -fno-tree
-dce -fno-optimize-sibling-calls  -fPIC   -c crypt_gensalt.c
gcc -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_UTIL_H    -fPIC -O2 -fno-tree
-dce -fno-optimize-sibling-calls  -fPIC   -c crypt_blowfish.c
gcc -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_UTIL_H    -fPIC -O2 -fno-tree
-dce -fno-optimize-sibling-calls  -fPIC   -c bcrypt_ext.c
gcc -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_RUBY_UTIL_H    -fPIC -O2 -fno-tree
-dce -fno-optimize-sibling-calls  -fPIC   -c wrapper.c
In file included from /usr/include/ruby/util.h:22:0,
                 from wrapper.c:28:
/usr/include/ruby/defines.h:71:7: error: conflicting types for ‘ruby_xmalloc’
 void *xmalloc(size_t);
       ^
In file included from /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/ruby.h:37:0,
                 from wrapper.c:26:
/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/defines.h:49:7: note: previous declaration of ‘ruby_xmalloc’ was here
 void *xmalloc _((long));
       ^
In file included from /usr/include/ruby/util.h:22:0,
                 from wrapper.c:28:
/usr/include/ruby/defines.h:73:7: error: conflicting types for ‘ruby_xcalloc’
 void *xcalloc(size_t,size_t);
       ^
In file included from /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/ruby.h:37:0,
                 from wrapper.c:26:
/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/defines.h:50:7: note: previous declaration of ‘ruby_xcalloc’ was here
 void *xcalloc _((long,long));
       ^
In file included from /usr/include/ruby/util.h:22:0,
                 from wrapper.c:28:
/usr/include/ruby/defines.h:74:7: error: conflicting types for ‘ruby_xrealloc’
 void *xrealloc(void*,size_t);
       ^
In file included from /usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/ruby.h:37:0,
                 from wrapper.c:26:
/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux/defines.h:51:7: note: previous declaration of ‘ruby_xrealloc’ was here
 void *xrealloc _((void*,long));
       ^
make: *** [wrapper.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/bcrypt-3.1.7 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/bcrypt-3.1.7/ext/mri/gem_make.out
ERROR:  Could not find a valid gem '3.1.5' (>= 0) in any repository

This is basically a rather spurious outpouring of problems from 'make' failing to complete. I have found a lot of people have had problems installing bcrypt but none of the suggestions they use solve this particular problem.

How can I solve this problem?

1 Answer 1

1

After a closer look at the output, I noticed the list of errors are paired. It looks like they are seperate errors however, they are actually in pairs based on the conflict mentioned in the output. Each pair is referring to two different directories, each corresponding to a different installation of ruby.

After removing the system installed version (ie through 'yum') and leaving the rvm installed version, then running the gem install command, the problem is solved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.