4

Ruby on Rails は初めてで、インストール中に以下のエラーが発生します。

最新の Xcode とコマンド ライン ツールをインストールし、OSX 10.8.4 を使用していることに注意してください。Ruby 2.0.0もインストールしました。

-bash-3.2$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** 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=/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'


Gem files will remain installed in /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12 for inspection.
Results logged to /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem_make.out
4

4 に答える 4

6

シンボリックリンクは私の問題を解決しませんでした。入力してrvmを使用して以前にインストールしたRubyをアンインストールし、rvm uninstall ruby-2.0.0次に入力しましたrvm requirements。このコマンドにより、gcc46 など、他にもいくつかのものが必要であることがわかりました。xcodeコマンドラインツールをインストールしたにもかかわらず、gccコンパイラが必要だったのは奇妙で、gccは間違いなく私のシステムにインストールされていました。

したがって、通常の方法がどれも機能しない場合は、試してみてrvm requirementsください。

于 2013-10-19T06:01:46.677 に答える
1

この質問と同じ問題だと思います。

何度も試してsudo ln -s /usr/bin/{llvm-,}gcc-4.2くださいgem install rails

ところで、あなたは自分のホーム ディレクトリにいるので、使用する必要はありませんsudo

于 2013-08-07T05:41:15.923 に答える