无法在Ubuntu 12.10上安装pg宝石

3

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

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

尝试按照此处提到的方式安装build-essential软件包:https://dev59.com/FXA75IYBdhLWcg3wxcHV#12269483。该线程中的其他答案,特别是关于`rvmsudo`的答案,也可能有所帮助。 - Prakash Murthy
我确实做了那件事,但是 build-essential 已经安装并且我有最新版本。 - vedarthk
3个回答

2
尝试安装PostgreSQL开发头文件: sudo apt-get install libpq-dev

重复的https://dev59.com/FXA75IYBdhLWcg3wxcHV - Gonzalo Matheu
@vedarthk已经表明他们已经安装了这个软件包。这不可能是答案。(因此不是重复的问题) - Kurt

0

我在RHEL 6.4上遇到了类似的问题,以下方法对我有效:

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

我从他们自己的仓库安装了PostgreSQL。


0

我正在使用rvm,使用“sudo apt-get install ruby-dev”命令会出现错误:“ruby-dev:依赖于ruby1.9.1-dev(> = 1.9.3.194-1),但它将不会被安装”。 - vedarthk

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接