当我运行软件包安装时,如何传递一个用于gem安装的参数? [英] How can I pass a parameter for gem installation when I run bundle install?
本文介绍了当我运行软件包安装时,如何传递一个用于gem安装的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将 pg gem 添加到我的gemfile中
gem'pg'
bundle install
,我得到这个错误:
安装pg(0.10。 1)本地扩展/Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in`在build_extensions中的块中救援:错误:无法构建gem原生扩展。 (Gem :: Installer :: ExtensionBuildError)
/Users/benhartney/.rvm/rubies/ruby-1.9.2-p0/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-pg-config = / path / to / pg_config
当我使用 bundle install
?
解决方案你需要设置一个构建配置选项,如下所示:
bundle config build.pg --with-pg -config = / path / to / pg_config
更多信息可以在软件包配置手册页
I added the pg gem to my gemfile
gem 'pg'
When I run bundle install
, I get this error:
Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/benhartney/.rvm/rubies/ruby-1.9.2-p0/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.
It seems I need to pass in this config parameter
--with-pg-config=/path/to/pg_config
How can I do this when I use bundle install
?
解决方案
You need to set a build config option like so:
bundle config build.pg --with-pg-config=/path/to/pg_config
More info can be found in the bundle config man page
这篇关于当我运行软件包安装时,如何传递一个用于gem安装的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文