无法在Ubuntu 12.10上安装pg gem

时间:2013-01-23 10:49:34

标签: ruby gem postgresql-9.1 pg ubuntu-12.10

我正在使用64位的Ubuntu 12.10,并且我安装了以下软件包:

dpkg --get-selections | grep postgre

输出:

postgresql
postgresql-9.1
postgresql-client
postgresql-client-9.1
postgresql-client-common
postgresql-common
postgresql-contrib
postgresql-contrib-9.1
postgresql-server-dev-9.1
postgresql-server-dev-all
libpq-dev
libpq5

rvm 1.17.9

ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]

我无法安装pg gem我收到以下错误:

ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /home/vedarthk/.rvm/rubies/ruby-1.9.3-p362/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)

我也尝试过以下命令,但输出与上面相同:

gem install pg -- --with-pg-include=/usr/include/postgresql/libpq --with-pg-lib=/usr/lib/postgresql/9.1/lib


gem install pg -- --with-pg-include=/usr/include/postgresql --with-pg-lib=/usr/lib/postgresql/9.1/lib

3 个答案:

答案 0 :(得分:2)

尝试安装PostgreSQL开发标题:

sudo apt-get install libpq-dev

答案 1 :(得分:0)

尝试 - $ sudo apt-get install ruby​​-dev

sudo gem install pg won't work有这个解决方案,它对我有用。

答案 2 :(得分:0)

我在RHEL 6.4上遇到了类似的问题,以下内容对我有用:

gem install /opt/redmine/vendor/cache/pg-0.18.4.gem --local -- --with-pg-dir=/usr/pgsql-9.4/

我从他们自己的回购设置了PostgreSQL。

相关问题