postgresql - gem install pg --with-pg-config 有效, bundle 失败

标签 postgresql rubygems bundler pg

当我运行时(作为 root)

gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config

我得到以下输出:

#-> gem instal pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Building native extensions.  This could take a while...
Successfully installed pg-0.12.0
1 gem installed
Installing ri documentation for pg-0.12.0...
Installing RDoc documentation for pg-0.12.0...
#-> 

当我运行 bundle install 时:

Installing pg (0.12.0) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby 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:
--with-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-1.9.2-p290/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config


Gem files will remain installed in /var/www/simpletrac/vendor/cache/ruby/1.9.1/gems/pg-    0.12.0 for inspection.
Results logged to /var/www/simpletrac/vendor/cache/ruby/1.9.1/gems/pg-0.12.0/ext/gem_make.out
An error occured while installing pg (0.12.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.12.0'` succeeds before bundling.

我在/usr/pgsql-9.1/include/libpq-fe.h 安装了 libpq-fe.h。所以,我试过了

gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config --with-pg-lib=/usr/pgsql-9.1/include/libpq-fe.h but still no go. 

如有任何帮助,我们将不胜感激。

此外,我还安装了 postgresql91-devel 和 ruby​​-devel。运行 CentOS 6。

最佳答案

您是否尝试过在运行 bundle install 之前运行它?

bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

参见 http://bundler.io/v1.3/bundle_config.html

关于postgresql - gem install pg --with-pg-config 有效, bundle 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9234960/

相关文章:

mysql - MySQL 以外的 Postgres 中使用 INT 进行除法的结果

ubuntu - gem install 返回 FloatDomainError Infinity 或 NaN

ruby-on-rails - Bundler 2 未安装在 docker 中

sql - 尽管源表中缺少记录,如何始终运行 UPDATE FROM?

c - 如何安装 pgAudit 扩展?

postgresql - 如何将 PGAdmin 连接到 Azure 上的 PostgreSQL?

ruby-on-rails - 如何使用 Reform 预填充特色对象?

ruby-on-rails - 使用 Roo Gem 在 Rails 中解析 XLS 电子表格

ruby-on-rails - 使用多个 Bundler 版本

ruby-on-rails - 我应该采取什么步骤来添加我新创建的 Gem?我怎样才能访问它?