2

私は実行していますOSX 10.8.2、コマンドラインツールでインストールされたXcode。

バンドルしようとしていますが、いくつかの宝石(下部で指定します)で次のようになります。

ERROR: Failed to build gem native extension

..。

Could not create Makefile due to some reason

gem 'pg'これまでのところ、とでエラーが発生しますgem 'binding_of_caller'

エラーはMakefileを作成できないことと関係があると思いますが、エラーを解決するのに役立つものは何も見つかりません。以下に完全なエラーを貼り付けました:

私は何をすべきか途方に暮れています。

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

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib


Gem files will remain installed in /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1 for inspection.
Results logged to /Users/ericavirtue/.bundler/tmp/75812/gems/pg-0.14.1/ext/gem_make.out
An error occurred while installing pg (0.14.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling.

編集:私はrbenvrubyのバージョンを管理するために使用していて、実行していると表示されます1.9.3 -p385システムrubyは古いバージョンですが、私が知る限り、それは問題ではありません。

postgresql経由でインストールしましたhomebrew

編集2:

RVMルビー管理に切り替えようとしましたが、別のmakeエラーが発生します:

Error running 'make -j2', please read ... ruby-1.9.3-p385/make.log
There has been an error while running make. Halting the installation.

make.logファイルが存在しません...

4

2 に答える 2

3

postgresをインストールする必要があります。http://deveiate.org/code/pg/README_rdoc.htmlから必要なもの:

  • Ruby1.8.7-p249または1.9.3-p0。
  • PostgreSQL 8.3.x(ヘッダー、-devパッケージなどを含む)。

brewを使用している場合は、

brew install postgresql

binding_of_callerに関しては、どのバージョンのrubyを使用していますか?

于 2013-02-19T15:45:45.087 に答える
1

そこでsudo env ARCHFLAGS="-arch x86_64" gem install pg、pgをインストールすることでこの問題を解決しましたが、データベースを作成したり、サーバーを実行したりしようとすると、さまざまな問題が発生します。これらの問題について別の質問を作成します。

于 2013-02-19T18:46:38.710 に答える