我在安装 mechanize
Gem:
[root@nemon ~]# gem install mechanize
> (RuntimeError) You have to install development tools first.
Whole log:
Building native extensions. This could take a while... ERROR: Error installing mechanize:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb checking for main() in -lstdc++... *** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib /usr/share/ruby/mkmf.rb:434:in try_do: The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.
from /usr/share/ruby/mkmf.rb:519:in try_link0
from /usr/share/ruby/mkmf.rb:534:in try_link
from /usr/share/ruby/mkmf.rb:720:in try_func
from /usr/share/ruby/mkmf.rb:950:in block in have_library
from /usr/share/ruby/mkmf.rb:895:in block in checking_for
from /usr/share/ruby/mkmf.rb:340:in block (2 levels) in postpone
from /usr/share/ruby/mkmf.rb:310:in open
from /usr/share/ruby/mkmf.rb:340:in block in postpone
from /usr/share/ruby/mkmf.rb:310:in open
from /usr/share/ruby/mkmf.rb:336:in postpone
from /usr/share/ruby/mkmf.rb:894:in checking_for
from /usr/share/ruby/mkmf.rb:945:in have_library
from extconf.rb:6:in <main>
Gem files will remain installed in `/usr/local/share/gems/gems/unf_ext-0.0.7.1` for inspection.
Results logged to `/usr/local/share/gems/gems/unf_ext-.0.7.1/ext/unf_ext/gem_make.out`