Missing dependency libpq.so.4 on Centos 5
This is probably the same problem as this issue, which is why I always (make) install mine from source to avoid package management problems like this:
pg_config, ruby pg, postgresql 9.0 problem after upgrade, centos 5
PostgreSQL gem pg was unable to install
I got the same error on Centos. By googling I found two commands to use:
yum install postgresql-libs
-- It gave me message saying, its already installed.yum install postgresql-devel
-- It solved my error related topg_config
for installing the 'pg' .gem.
Hope it helps :)
apos wrote: on Ubuntu 14.04 install:
apt-get install postgresql-server-dev-9.3 libpq-dev
Postgresql 9.2 on Centos 5, rails, bundle - PostgreSQL is too old
The PostgreSQL Development Group has packages for Pg 9.3 on CentOS 5.
See yum.postgresql.org.
However, installing Pg 9.3 won't remove 8.1. It'll still be on your PATH
. It'll still be running, too.
If you want to use the 9.3 psql
and libpq
, you need to alter your PATH
and LD_LIBRARY_PATH
to prefer the PostgreSQL 9.3 install. Then rebuild the Pg
gem against the new libpq
.
Something like:
export PATH="/usr/pgsql-9.3/bin:$PATH"
export LD_LIBRARY_PATH="/usr/pgsql-9.3/lib/:$LD_LIBRARY_PATH"
gem uninstall pg
gem install pg
If you want this to take effect globally you can modify /etc/ld.so.conf
to put the new path in place by default, and /etc/environment
to set the PATH
appropriately.
Otherwise, add the first two lines to your ~/.bash_profile
.
Separately, these are rather worrying:
/etc/rc.d/init.d/functions: fork: Cannot allocate memory
/etc/profile.d/lang.sh: line 53: /sbin/consoletype: Argument list too long
as they suggest something is mismatched/broken on the system. Not necessarily PostgreSQL related. Have you force-installed any RPMs or used any 3rd party repos?
unable to install pg gem
Answered here:
Can't install pg gem on Windows
There is no Windows native version of
latest release of pg (0.10.0) released
yesterday, but if you install 0.9.0 it
should install binaries without
issues.
gem install pg --with-pg-config works, bundle fails
Have you tried running this before running bundle install
?
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config
See http://bundler.io/v1.3/bundle_config.html
Rails: Installing PG gem on OS X - failure to build native extension
Same error for me and I didn't experience it until I downloaded OS X 10.9 (Mavericks). Sigh, another OS upgrade headache.
Here's how I fixed it (with homebrew):
- Install another build of Xcode Tools (typing
brew update
in the terminal will prompt you to update the Xcode build tools) brew update
brew install postgresql
After that gem install pg
worked for me.
Install pg gem on CentOS 6
Before:
For Centos 6: Right install Postgres 9.* with this guide.
After:
yum install postgresql-libs postgresql-devel
Helpful instruction:
How to setup RoR with Postgres
Can't find the 'libpq-fe.h header when trying to install pg gem
It looks like in Ubuntu that header is part of the libpq-dev
package (at least in the following Ubuntu versions:
11.04 (Natty Narwhal), 10.04 (Lucid Lynx), 11.10 (Oneiric Ocelot), 12.04 (Precise Pangolin), 14.04 (Trusty Tahr) and 18.04 (Bionic Beaver)):
...
/usr/include/postgresql/libpq-fe.h
...
So try installing libpq-dev
or its equivalent for your OS:
- For Ubuntu/Debian systems:
sudo apt-get install libpq-dev
- On Red Hat Linux (RHEL) systems:
yum install postgresql-devel
- For Mac Homebrew:
brew install postgresql
- For Mac MacPorts PostgreSQL:
gem install pg -- --with-pg-config=/opt/local/lib/postgresql[version number]/bin/pg_config
- For OpenSuse:
zypper in postgresql-devel
- For ArchLinux:
pacman -S postgresql-libs
Related Topics
Setting Mime Type for .Ogv Files in Rails Development Environment
Array Typeerror: Can't Convert Fixnum into String
Remove Double Quotes from String
How to Read a Gzip File Line by Line
Telling Bundler to Exclude Certain Gems from a Particular Gem's Installation
How to Implement Yes/No Instead of Boolean for Certain Cases in Rails
Bitwise Operations on Strings with Ruby
How to Force a Gem's Dependencies in Gemfile
How to Perform Vector Addition in Ruby
How to Run Rake with --Trace Within Capistrano
Ruby Daemons and Jruby - Alternative Options
Documentation for Psych To_Yaml Options
How to Write Bom Marker to a File in Ruby
Split Seeds.Rb into Multiple Sections
Execjs::Programerror in Welcome#Index Typeerror: Object Doesn't Support This Property or Method