pg gem与Ubuntu

时间:2012-11-07 19:04:35

标签: ruby-on-rails gem

我正在尝试使用新的rails应用程序安装pg gem,但我一直收到同样的错误:

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

        /home/arthur/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-pg-lib=/usr/lib
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.

我已经尝试过这个问题:How to install PostgreSQL's pg gem on Ubuntu? 但没有什么对我有用。

顺便说一下,这是ruby 1.9.2和Rails 3.2。

由于

1 个答案:

答案 0 :(得分:1)

安装postgresql 9然后安装你的gem。

sudo apt-get install postgresql libpq-dev

现在,运行

gem install pg

然后

捆绑安装