我试图"捆绑"在AWS EC2 Linux服务器中使用rails app。我为#34; pg"收到此错误宝石。有人可以帮忙吗?无法找到解决方案。
这个宝石''版本为0.17.1。
Ruby版本是ruby 2.3.1p112(2016-04-26修订版54768)[x86_64-linux]
$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/home/ec2-user/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20180105-17661-1wdsn6j.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/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:
--something something something
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pg-0.21.0 for inspection.
Results logged to /home/ec2-user/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/pg-0.21.0/gem_make.out
答案 0 :(得分:1)
当我在gem 'pg'
或centos
上安装ubuntu
时,我遇到了一些问题。
对于centos,你可以这样做:
yum install postgresql-libs
yum install postgresql-devel
然后再次运行gem install pg
。
答案 1 :(得分:0)
在 Ubuntu 上,我需要运行:
sudo apt-get install libpq-dev