首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gem install pg --with-pg-config工作,捆绑失败

gem install pg --with-pg-config工作,捆绑失败
EN

Stack Overflow用户
提问于 2012-02-11 05:20:35
回答 18查看 74.8K关注 0票数 74

WhenI运行(以根用户身份)

代码语言:javascript
复制
gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config

我得到以下输出:

代码语言:javascript
复制
#-> 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时:

代码语言:javascript
复制
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。所以,我试着

代码语言:javascript
复制
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。

EN

回答 18

Stack Overflow用户

回答已采纳

发布于 2012-02-11 05:32:55

在运行bundle install之前,您是否尝试过运行此程序

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

请参阅http://bundler.io/v1.3/bundle_config.html

票数 188
EN

Stack Overflow用户

发布于 2012-04-23 16:21:43

如果有人使用macports安装postgres,并且在查找他们的pg_config时遇到问题,可以尝试这样做:

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config

我希望这能帮助某人节省一些时间。干杯!

票数 19
EN

Stack Overflow用户

发布于 2016-02-02 13:42:04

如果您不确定您的pg_config在哪里,并且假设您在Linux或Mac上,您可以运行以下命令:

代码语言:javascript
复制
which pg_config

这将返回==> /usr/pgsql-9.1/bin/pg_config

现在将此路径用作

代码语言:javascript
复制
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config

现在完成bundle install

票数 14
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9234960

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档