Incorrect installation of pg gem

I have a rails application that I am trying to run on an instance of Amazon EC2. This application has been tested correctly on various Linux, OS X, and Windows systems.

On EC2 server, I built PostgresSQL 9 from the source. At first, "pg" gem did not install, but I built it with the following command:

gem install pg -- --with-pgsql-lib=/usr/local/pgsql/lib --with-pgsql-config=/usr/local/pgsql/bin/pg_config

It seemed like it was built correctly. However, when I run a rake task, such as "rake db: migrate", I get the following error:

rake aborted!
libpq.so.5: cannot open shared object file: No such file or directory - /home/ec2-user/.rvm/gems/ruby-1.8.7-p334/gems/pg-0.11.0/lib/pg_ext.so
+3
source share
4 answers

"" , /usr/local/pgsql/lib , . /etc/ld.so.conf ( ) LD_LIBRARY_PATH, rake.

+4

EC2 pg gem:

sudo yum install postgresql-devel
+7

Weird I fully supported RVM and did the exact same thing, but this time with the ARCHFLAGS suite. It occurred to me that I forgot to install it.

env ARCHFLAGS=" -arch x86_64"
+1
source

The only way to solve this problem is to add a symbolic link so that it can find it.

ln -s /usr/pgsql-9.2/lib/libpq.so.5.5 /usr/lib/libpq.so.5
0
source

All Articles