Created
May 24, 2015 20:04
-
-
Save hoanghiep90/e3f84de652e28b0d8496 to your computer and use it in GitHub Desktop.
Can’t find the ‘libpq-fe.h header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I need to install pg 0.17.1 gem on a server running CentOS. This is the error message I saw: | |
# gem install pg -v '0.17.1' | |
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. | |
... | |
First thing came to my mind is that, I must have forgotten to install the -dev package. | |
# yum install postgresql93-devel | |
Then, when I ran gem command again, suprisingly I still got the same error message. So I checked the explanation in the error message carefully. | |
# locate pg_config | |
/usr/pgsql-9.3/bin/pg_config | |
/usr/pgsql-9.3/share/man/man1/pg_config.1 | |
# gem install pg -v '0.17.1' -- --with-pg-config=/usr/pgsql-9.3/bin/pg_config | |
This time, pg gem was successfully installed. | |
Note, if you use bundle to install gem, you’ll need to run this command: | |
# bundle config build.pg --with-pg-config=/usr/pgsql-9.3/bin/pg_config | |
# bundle install --path vendor/bundle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for sharing this!