[英]gem install pg only works as sudo
I have read a lot on this topic, but seems like nobody has had the exact problem I am having. 我已经阅读了很多有关此主题的内容,但似乎没有人遇到我遇到的确切问题。
I am trying to install Postgres support for Rails 3 on Ubuntu. 我正在尝试在Ubuntu上安装Postgres对Rails 3的支持。 If I run: 如果我运行:
sudo gem install pg
everything works fine. 一切正常。
However, I am using GemFile and trying to deploy my application to Heroku, so doing: 但是,我正在使用GemFile并尝试将我的应用程序部署到Heroku,所以请执行以下操作:
bundle install
As part of the bundle install it fails when doing gem install pg with the following error: 作为捆绑安装的一部分,在执行gem install pg时失败,并显示以下错误:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.9/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /Library/PostgreSQL/9.1/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
Any ideas why this is happening. 任何想法为什么会这样。 Surely it would also fail to install as sudo if I do not have the correct libraries installed. 如果我没有安装正确的库,肯定也会以sudo的形式安装。 Is this some kind of permissions problem? 这是某种权限问题吗?
Thanks for your help in advance, 谢谢您的帮助
Olli 奥利
I believe you need to install libpq. 我相信您需要安装libpq。 Please try: 请试试:
sudo apt-get install libpq-dev
And btw, this may be a helpful hint for you. 顺便说一句,这可能对您有帮助。 I usually setup my development environment using this chain (this is valid for Ubuntu 12.04 LTS): 我通常使用此链来设置开发环境(这对Ubuntu 12.04 LTS有效):
sudo apt-get install libpq-dev build-essential openssl libreadline6 libreadline6-dev curl zlib1g \
zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev \
autoconf libc6-dev ncurses-dev automake libtool bison subversion ncurses-term \
exuberant-ctags libnotify-bin curl autoconf make automake ssh git-core git-doc imagemagick libpq-dev vim \
libreadline5 libmysqlclient-dev imagemagick libmagick+5 \
libmagick++-dev libmagickwand4 libmagickcore4 libmagickcore4-extra libmagickcore-dev \
libmagickwand-dev \
tmux libcurl4-openssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 postgresql-contrib mysql-server memcached \
gimp chromium-browser chromium-codecs-ffmpeg-extra chromium-browser-inspector \
bind9 terminator libqt4-dev xvfb gitk postgresql pgadmin3 rar unrar\
ubuntu-restricted-extras vlc compizconfig-settings-manager gstreamer0.10-plugins-ugly flashplugin-installer
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.