错误:由于PostgreSQL太旧,无法构建gem原生扩展

时间:2014-07-15 04:15:56

标签: ruby-on-rails ruby postgresql

我试图在Mavericks的Rails项目中运行bundle。使用此错误到达pg gem时失败。

它说你的PostgreSQL太旧了。安装此gem的旧版本或升级数据库。。所以我安装了postgresql-9.3.4gem install gem,但发生了同样的错误。

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

    /path/to/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/local/php5/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... yes
checking for PQconnectionUsedPassword()... no
Your PostgreSQL is too old. Either install an older version of this gem or upgrade your database.
*** 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=/path/to/.rvm/rubies/ruby-2.1.1/bin/ruby
    --with-pg
    --without-pg
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --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-pqlib
    --without-pqlib

extconf failed, exit code 1

提前致谢。

1 个答案:

答案 0 :(得分:1)

尝试将postgresql安装添加到您的路径中:

export PATH=/usr/pgsql-9.3.4/bin:$PATH