【发布时间】:2015-05-03 01:59:43
【问题描述】:
每当我在我的 VPS(CentOS Linux 版本 7.0.1406 (Core))上运行 bundle install 时,安装 pg gem 时都会出错。
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.
我可以使用 gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config 独立安装 pg,问题已解决。
所以我添加了一个 capistrano 任务来创建一个 ./bundle/config 用于部署,其中 build.pg 键设置为我的 VPS 上的 pg_config 路径。在 Capistrano 中,config/deploy.rb 调用了 before bundler:install。
desc "Create bundle config"
task :prepare_bundle_config do
on roles(:app) do
within release_path do
execute :bundle, 'config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config --local'
end
end
end
我已经安装了必要的软件包:
postgresql94-server.x86_64
postgresql94-devel.x86_64
postgresql94-libs.x86_64
libpqxx.x86_64
libpqxx-devel.x86_64
这是我安装的 capistrano* gems
bundle list | grep capistrano
* capistrano (3.3.5)
* capistrano-bundler (1.1.4)
* capistrano-rails (1.1.2)
* capistrano-rbenv (2.0.3)
* capistrano-stats (1.1.1)
使用捆绑器成功安装 pg 我在这里缺少什么?如果您需要任何其他信息,请发表评论,我会更新这篇文章。
【问题讨论】:
标签: centos capistrano bundler pg centos7