简体   繁体   English

无法在 Fedora 17 上安装 PG gem

[英]Unable to install PG gem on Fedora 17

The pg gem is being stubborn so I can't load my app on new computer. pg gem 很顽固,所以我无法在新计算机上加载我的应用程序。 Seems like multiple problems, not being able to locate pg_config and then extconf.rb似乎是多个问题,无法找到 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.

any linux people out there that have dealt with this problem?那里有处理过这个问题的Linux人吗?

这是通过解决的

$ yum install /usr/include/libpq-fe.h

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

sudo yum install postgresql-devel

for fedora 30:对于软呢帽 30:

$sudo dnf install libpq-devel

then:然后:

$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

~ Hi 〜嗨

I had the same problem installing the gem "pg" in my Rails project, when ran the command "bundle install" had the same error, in my case partiuclar solve it as follows: 我在我的Rails项目中安装gem“pg”时遇到同样的问题,当运行命令“bundle install”有同样的错误时,在我的情况下partiuclar解决它如下:

I use Fedora 19, I guess it can be solved in the same way in Fedora 17: 我使用Fedora 19,我猜它可以在Fedora 17中以相同的方式解决:

I Installed Postgres using the following tutorial: 我使用以下教程安装了Postgres:

Then, I added the next line in my ~/.bashrc to solve the problem with the pg_config: 然后,我在〜/ .bashrc中添加了下一行来解决pg_config的问题:

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

And finally to solve the problem with libpq-fe.h, I installed postgresql-devel as follows: 最后用libpq-fe.h来解决问题,我安装了postgresql-devel,如下所示:

  • # yum install postgresql92-devel

Finally in my Rails project ran the command "bundle install" and no more errors. 最后在我的Rails项目中运行命令“bundle install”并且没有更多错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM