2

I'm running OSX 10.8.2, Xcode installed with command line tools.

I'm trying to bundle, and on some gems (I'll specify at the bottom) I am getting the following:

ERROR: Failed to build gem native extension

...

Could not create Makefile due to some reason

So far I get the error on the gem 'pg' and gem 'binding_of_caller'

I believe the error has something to do with the inability to create Makefile, but can't find anything helpful to solve the error. I've pasted the full error below:

I'm at a loss for what to do.

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.

EDIT: I'm using rbenv to manage ruby versions and it says I am running 1.9.3 -p385The system ruby is an older version, but that shouldn't matter as far as I know.

I have postgresql installed via homebrew

EDIT 2:

I tried switching to RVM for ruby management, but get another make error:

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

The file make.log doesn't exist ...

4

2 回答 2

3

您需要安装 postgres。从http://deveiate.org/code/pg/README_rdoc.html你需要:

  • 红宝石 1.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 回答