无法在Fedora 17上安装PG gem

时间:2012-12-02 01:56:44

标签: ruby-on-rails linux postgresql rvm fedora

pg gem很顽固,所以我无法在新电脑上加载我的应用程序。似乎有多个问题,无法找到pg_config,然后是extconf.rb

#psql working...
psql (9.2.1)
Type "help" for help.

nd =>
\q

$ pg_config:

#adding the path to bashrc...
$ nano .bashrc

PATH=/usr/pgsql-9.2/bin:$PATH

#seems to work...
pg_config: /usr/pgsql-9.2/bin/pg_config

$ sudo gem install pg

#but i get the same errors...
Building native extensions.  This could take a while...
.......
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.

那些处理过这个问题的linux人员?

4 个答案:

答案 0 :(得分:16)

解决了这个问题
$ yum install /usr/include/libpq-fe.h

答案 1 :(得分:13)

对于Fedora 20+,需要以下软件包:

sudo yum install postgresql-devel

答案 2 :(得分:0)

〜嗨

我在我的Rails项目中安装gem“pg”时遇到了同样的问题,当运行命令“bundle install”有同样的错误时,在我的情况下,partiuclar解决它如下:

我使用Fedora 19,我想它可以在Fedora 17中以相同的方式解决:

我使用以下教程安装了Postgres:

然后,我在〜/ .bashrc中添加了下一行来解决pg_config的问题:

  • PATH = / usr/pgsql-9.2/bin: $ PATH

最后用libpq-fe.h来解决问题,我按如下方式安装了postgresql-devel:

  • # yum install postgresql92-devel

最后在我的Rails项目中运行了“bundle install”命令而不再出现错误。

答案 3 :(得分:0)

浅顶软呢帽30:

$sudo dnf install libpq-devel

然后:

$gem install pg

Building native extensions. This could take a while...
Successfully installed pg-1.1.4
Parsing documentation for pg-1.1.4
Installing ri documentation for pg-1.1.4
Done installing documentation for pg after 1 seconds
1 gem installed