1

バンドルのインストールに問題があります。

これらは私の最後のステップでした:

  • git clone http:...
  • git checkout -b daniel
  • bundle install

私が得たエラーは次のとおりです。

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.

        /Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb  checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
    --with-pthreadlib   --without-pthreadlib    --with-objclib
    --without-objclib   --enable-debug  --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError)   from
extconf.rb:20:in `<main>'


Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out
An error occurred while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that `gem install therubyracer -v '0.11.0'`
succeeds before bundling.

実行しようとすると、次のようgem install therubyracer -v '0.11.0'になりました。

Building native extensions.  This could take a while... ERROR:  Error
installing therubyracer:    ERROR: Failed to build gem native extension.

        /Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb checking for main() in -lpthread... yes checking for main() in
-lobjc... yes
*** 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/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
    --with-pthreadlib   --without-pthreadlib    --with-objclib
    --without-objclib   --enable-debug  --disable-debug
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/build.rb:50:in
`build_with_rubygem_libv8': undefined local variable or method
`libv8_include_flags' for main:Object (NameError)   from
extconf.rb:20:in `<main>'


Gem files will remain installed in
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0 for
inspection. Results logged to
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/gems/therubyracer-0.11.0/ext/v8/gem_make.out

Mac OS 10.7.5 で作業しています。Xcode とそのコマンド ライン ツール、および Rails は最新です。SQLite 3 もインストールされています。

誰でも私を助けることができますか?


編集:

また、リポジトリを削除して再度クローンしようとしましたが、同じエラーが発生しました。


編集:

RailsとSqlite3のインストールパスは正しいですか?

daniel:~ 
daniel$ sudo gem update --system Latest version currently
installed. Aborting. 
daniel:~ 
daniel$ sudo gem install rails 
Fetching:
rails-3.2.11.gem (100%) Successfully installed 
rails-3.2.11 1 gem installed 
Installing ri documentation for rails-3.2.11... 
Installing RDoc documentation for rails-3.2.11... 
daniel:~ 
daniel$ sudo gem install sqlite3
Fetching: sqlite3-1.3.7.gem (100%) 
Building native extensions.  This could take a while... 
Successfully installed sqlite3-1.3.7 1 gem installed 
Installing ri documentation for sqlite3-1.3.7... 
Installing RDoc documentation for sqlite3-1.3.7...
daniel:~ 
daniel$ which ruby irb gem rake
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/irb
/Users/daniel/.rvm/rubies/ruby-1.9.3-p286/bin/gem
/Users/daniel/.rvm/gems/ruby-1.9.3-p286/bin/rake
4

1 に答える 1

2

少なくとも 1 つの問題は、RVM を実行しているがsudo、システムに gem をインストールするために使用されていることです。

「 RVM と RubyGems」、特に次の部分を読んでください。

「sudo を使用しないでください...」

RVM は、システム管理者でなくてもサンドボックスを管理できるように、マシン上の自分のユーザー空間にユーザー用のサンドボックスを作成します。sudoつまり、 RVM や gems の管理に使用する必要がないということです。

を使用すると、一時的にユーザーでなくなり、パスに RVM サンドボックスを含まないsudo管理者権限と管理者の環境を持つ管理者になります。サンドボックスの情報は、マシンのルートでは使用されない、環境内の PATH によって保持されます。そのサブシェル内にインストールされた Gem は、管理者アカウントが認識している場所 (システム Ruby インストール内) にインストールされます。これが、RVM サンドボックス化された Ruby がそれらを認識しない理由です: システムの Ruby とあなたのRVM 制御の RUby。それがサンドボックスの全体的な考え方です: 汚染を避けるために要素とリソースを分離します./Users/daniel/.rvm/rubies/ruby-1.9.3-p286sudo

次の出力を見ることで、これをすべて理解できたはずです。

which ruby irb gem rake

それらすべてのパスは、サンドボックスを指しています。

/Users/daniel/.rvm/rubies

Mac OS システムでは、そのコマンドは次のように報告されているはずです。

/usr/bin/ruby
/usr/bin/irb
/usr/bin/gem
/usr/bin/rake

以下を使用して、Rails と SQLite gem を再インストールします。

gem install rails sqlite3

バンドルがどのように動作するかを確認します。

sudoまた、システムにインストールされた Ruby を故意に管理/削除するために使用しないでください。これは、インストールしたソフトウェアを有効にするために、Apple が独自の目的でインストールしたものです。その存在を利用することは問題ありませんが、使用するために存在します。RVM 管理の Ruby を独自の目的で使用します。

于 2013-01-18T15:39:28.683 に答える