开发者

Problem installing pg gem properly

I have a rails app that I am trying to get running in an Amazon EC2 instance. This app has been tested properly o开发者_Python百科n various Linux, OS X and Windows systems.

On the EC2 server, I have built PostgresSQL 9 from source. At first, the 'pg' gem wouldn't 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

This seemed to build properly. 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


Did the trick for me on EC2 for pg gem:

sudo yum install postgresql-devel


From the error message and your description of your 'find' command output, it's possible that /usr/local/pgsql/lib is not in the path the dynamic linker searches for its libraries. Try adding that directory to /etc/ld.so.conf (or similar), or set LD_LIBRARY_PATH to include it before you run rake.


Weird. I backed out RVM completely and re-did everything exactly the same way but this time with the ARCHFLAGS set. It occurred to me that I had forgot to set it.

env ARCHFLAGS=" -arch x86_64"


The only way I could solve this was by adding a symlink so it could find it.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜