1
votes

i want to install bcrypt-ruby-3.1.2. ruby version is ruby 1.9.3p448.

root@bt:~# ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]


root@bt:# gem install bcrypt-ruby-3.1.2.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby-3.1.2.gem:
ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for ruby/util.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
 --srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby
 /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do':   The     compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
 from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:14:in `<main>'


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p448/gems/bcrypt-       ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p448/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out

As in suggested here(Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)) I have already installed ruby1.9.1-dev.

gem_make.out

  /usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for ruby/util.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p448/bin/ruby
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in  `try_do':            The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:14:in `<main>'

mkmf.log

"gcc -o conftest -I/usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/i686-linux  -I/usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/usr/  local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1 -I.  -D_FILE_OFFSET_BITS=64   -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.9.3-p448/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.3-p448/lib -L.  -rdynamic -Wl,-export-dynamic     '-Wl,-rpath,/../lib' -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.3-p448/lib -L/usr/local/rvm/rubies/ruby-1.9.3-p448/lib -lruby  -lpthread -lrt -ldl -lcrypt -lm   -lc"
In file included from /usr/local/include/crtdefs.h:10,
             from /usr/local/include/string.h:9,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
             from conftest.c:1:
/usr/local/include/_mingw.h:268:2: error: #error Only Win32 target is supported!
In file included from /usr/local/include/crtdefs.h:10,
             from /usr/local/include/string.h:9,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
             from conftest.c:1:
/usr/local/include/_mingw.h:656: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__debugbreak’
/usr/local/include/_mingw.h:657: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__debugbreak’
In file included from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
             from conftest.c:1:
/usr/local/include/string.h:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_memccpy’
/usr/local/include/string.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘memchr’
/usr/local/include/string.h:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_memicmp’
/usr/local/include/string.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_memicmp_l’
/usr/local/include/string.h:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘memcmp’
/usr/local/include/string.h:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘memcpy’
In file included from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48,
             from /usr/local/rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
             from conftest.c:1:

checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
1
show us mkmf.log, and gem_make.outМалъ Скрылевъ
mkmf.log & gem_make.out added into question.user1454
it seems the setup the ruby was not correctly done, which is system of yours?Малъ Скрылевъ
@majioa yes ; you are right, i reinstalled rvm ; and now i can install bcrypt gem.Thanks for your help.user1454

1 Answers

3
votes

It seems the setup the ruby was not correctly completed, because compiler can't properly handle the ruby headers. It is useful to try to reinstall a ruby inside rvm:

 $ rvm reinstall ruby-2.0.0