0

Mac OS X に hpricot をインストールする際に問題が発生しました。rvm と brew の間の問題ではないでしょうか?

rvm 1.0.5 醸造 0.7

考え?提案?ありがとう!

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

/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for stdio.h... no
*** 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/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby


Gem files will remain installed in /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2 for inspection.
Results logged to /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out
4

2 に答える 2

0

ERROR: Failed to build gem native extension.checking for stdio.h... no疑わしいです。Hpricot は、他の多くの Ruby gem と同様に、いくつかのコードをコンパイルする必要があり、開発パッケージが見つからないと失敗します。

RVM を実行していて、マシンの ~/.rvm に 1.8.7 があるため、RVM が Ruby をコンパイルする必要があるためと思われますが、失敗はそうではないようです。/Developer ディレクトリに Apple の XCode がインストールされていますか? インストールしていない場合やディレクトリが存在しない場合は、MacOS インストール ディスクまたは Apple の開発者サイト ( http://developer.apple.com/technologies/xcode.html ) でインストーラーを見つけることができます。

それはさておき、Hpricot よりも Nokogiri を使用することをお勧めします。しばらく前に Hpricot でいくつかのバグに遭遇したため、自分のニーズに合わせて使用​​できなくなり、Nokogiri に切り替えました。2 つの gem の構文が似ていることがわかります。http://nokogiri.org/

于 2010-10-03T19:11:57.350 に答える
0

これは XCode のバージョン依存であることが判明しました。XCode を 3.2.4 に更新すると、これが解決されました。

于 2010-10-05T14:27:02.527 に答える