Ruby on rails 4 rails 4.2.0:can';在ubuntu 14.04上安装pg gem
我最近尝试将我的rail 3.2*应用程序升级到rails 4.2.*。但是,我在安装Ruby on rails 4 rails 4.2.0:can';在ubuntu 14.04上安装pg gem,ruby-on-rails-4,pg,Ruby On Rails 4,Pg,我最近尝试将我的rail 3.2*应用程序升级到rails 4.2.*。但是,我在安装'pg'gem时被阻止了。当我在谷歌上搜索时,这些解决方案大多只与OSX相关。但我使用的是ubuntu 14.04。需要任何关于以下问题的建议 我已经在我的机器上安装了postgresql 9.3.5版本 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/local/rvm/rubies/ruby-2.1.2
'pg'
gem时被阻止了。当我在谷歌上搜索时,这些解决方案大多只与OSX相关。但我使用的是ubuntu 14.04。需要任何关于以下问题的建议
我已经在我的机器上安装了postgresql 9.3.5
版本
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2@r4/gems/pg-0.18.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2@r4/extensions/x86_64-linux/2.1.0/pg-0.18.1/gem_make.out
An error occurred while installing pg (0.18.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.1'` succeeds before bundling.
您需要安装头为postgreSQL的postgreSQL开发包
sudo apt-get install libpq-dev
你也可以试试
sudo apt-get install postgresql-client
sudo apt-get install postgresql postgresql-contrib
在ubuntu 14.04上用postgresql 9.4安装pg-v 0.18.1时遇到了这个问题
sudo apt-get install libpq-dev build-essential postgresql-server-dev-9.4
基本上我缺少postgresql server开发-${version}
在你的情况下,试试看
sudo apt-get install libpq-dev build-essential postgresql-server-dev-9.3
在ubuntu 16.04上执行此命令
sudo apt install libpq-dev postgresql-server
sudo -u postgres createuser -s $(whoami); createdb $(whoami)
gem install pg
我已经安装了那些依赖软件包。但是,我又一次失败了。你看过sudo apt get install postgresql postgresql contrib吗,这可能对你有用是的,我已经在SF中查看了给定的链接和其他链接。但无论如何,这对我都没有帮助。第一个例子在我们的Ubuntu 14.04服务器上对我非常有用,谢谢。@black先生请查看我的答案并接受它作为正确答案谢谢!顺便说一句,sudo apt get install libpq dev对我来说已经足够了。我已经为此绞尽脑汁好几天了,直到安装了
build-essential
软件包(对于gem pg 0.21
)之前,一切都无济于事。。我在其他地方都没看到,所以谢谢你!尽管刚刚尝试了apt-get-install-libpq-dev-gcc-make
而不是完整的build-sential
,但效果也不错