The pg gem is being stubborn so I can't load my app on new computer. Seems like multiple problems, not being able to locate pg_config and then 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?
这是通过解决的
$ yum install /usr/include/libpq-fe.h
对于Fedora 20+,需要以下包:
sudo yum install postgresql-devel
for fedora 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:
I use Fedora 19, I guess it can be solved in the same way in Fedora 17:
I Installed Postgres using the following tutorial:
Then, I added the next line in my ~/.bashrc to solve the problem with the 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:
# yum install postgresql92-devel
Finally in my Rails project ran the command "bundle install" and no more errors.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.