如何在Ubuntu 14上安装Rails时修复错误

时间:2015-10-11 15:05:45

标签: ruby-on-rails ruby ruby-on-rails-4

我在Ubuntu 14~虚拟机中安装Rails时搞砸了所有内容并收到以下错误信息:

karol@karol-VirtualBox:~$ gem install rails -v 4.2.4 Fetching:
rack-1.6.4.gem (100%) Successfully installed rack-1.6.4 Fetching:
rack-test-0.6.3.gem (100%) Successfully installed rack-test-0.6.3
Building native extensions.  This could take a while... ERROR:  Error
installing rails:   ERROR: Failed to build gem native extension.

    /home/karol/.rvm/rubies/ruby-2.2.3/bin/ruby extconf.rb checking if the C compiler accepts ... *** 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=/home/karol/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
  --help    --clean
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file.
(RuntimeError) You have to install development tools first.     from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in
`block in try_compile'  from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in
`with_werror'   from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in
`try_compile'   from extconf.rb:80:in `nokogiri_try_compile'    from
extconf.rb:87:in `block in add_cflags'  from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in
`with_cflags'   from extconf.rb:86:in `add_cflags'  from
extconf.rb:337:in `<main>'


Gem files will remain installed in
/home/karol/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2 for inspection.
Results logged to
/home/karol/.rvm/gems/ruby-2.2.3/gems/nokogiri-1.6.6.2/ext/nokogiri/gem_make.out

gem_make.out:

/home/karol/.rvm/rubies/ruby-2.2.3/bin/ruby extconf.rb checking if the
C compiler accepts ... *** 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=/home/karol/.rvm/rubies/ruby-2.2.3/bin/$(RUBY_BASE_NAME)
  --help    --clean
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file.
(RuntimeError) You have to install development tools first.     from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in
`block in try_compile'  from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in
`with_werror'   from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in
`try_compile'   from extconf.rb:80:in `nokogiri_try_compile'    from
extconf.rb:87:in `block in add_cflags'  from
/home/karol/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in
`with_cflags'   from extconf.rb:86:in `add_cflags'  from
extconf.rb:337:in `<main>'

这是因为我试图解决这个问题:

The program 'rails' can be found in the following packages:  *
ruby-railties-3.2  * ruby-railties-4.0

老实说,我不知道我在那里做了什么。

我正在使用RVM。

你是否建议我取消与Ruby / Rails相关的所有内容,还是有另一种方式?

0 个答案:

没有答案