我已经阅读了很多关于这个主题的内容,但似乎没有人遇到我遇到的确切问题。
我正在尝试在Ubuntu上安装Postgres对Rails 3的支持。如果我跑:
sudo gem install pg
一切正常。
但是,我正在使用GemFile并尝试将我的应用程序部署到Heroku,所以这样做:
bundle install
作为捆绑安装的一部分,在执行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)
任何想法为什么会这样。如果我没有安装正确的库,它肯定也无法安装为sudo。这是某种权限问题吗?
提前感谢您的帮助,
奥利
答案 0 :(得分:1)
我相信你需要安装libpq。请尝试:
sudo apt-get install libpq-dev
顺便说一下,这可能对你有所帮助。我通常使用这个链设置我的开发环境(这对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