gem install pg --with-pg-config工作,捆绑失败 [英] gem install pg --with-pg-config works, bundle fails

查看:122
本文介绍了gem install pg --with-pg-config工作,捆绑失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行(以root身份)

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

我得到以下输出: p>

 # - > gem instal pg -v'0.12.0' -  --with-pg-config = / usr / pgsql-9.1 / bin / pg_config 
构建原生扩展。这可能需要一段时间...
已成功安装pg-0.12.0
1已安装gem
安装ri文档为pg-0.12.0 ...
安装RDoc文档pg-0.12.0 ...
# - >

运行bundle install时:

 使用本机扩展安装pg(0.12.0)
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。

/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
检查pg_config ... no
否pg_config ..无论如何尝试。如果构建失败,请再次尝试使用
--with-pg-config = / path / to / pg_config
检查libpq-fe.h ... no
无法找到'libpq-fe.h头文件
*** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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文件将保持安装在/ var / www / simpletrac / vendor / cache / ruby​​ / 1.9.1 / gems / pg-0.12.0进行检查。
结果记录到/var/www/simpletrac/vendor/cache/ruby/1.9.1/gems/pg-0.12.0/ext/gem_make.out
安装pg时发生错误(0.12。 0),Bundler无法继续。
确保在捆绑之前`gem install pg -v'0.12.0'`成功。

我在/usr/pgsql-9.1/include/libpq-fe上安装了libpq-fe.h 。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但仍然不行。 

任何帮助都将不胜感激。



另外,我安装了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


WhenI run (as root)

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

I get the following output:

#-> 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...
#-> 

When I run 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.

I have libpq-fe.h installed at /usr/pgsql-9.1/include/libpq-fe.h. So, I tried

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. 

Any help would be greatly appreciated.

Also, I have installed postgresql91-devel and ruby-devel. Running CentOS 6.

解决方案

Have you tried running this before running bundle install?

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

See http://bundler.io/v1.3/bundle_config.html

这篇关于gem install pg --with-pg-config工作,捆绑失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆