I added the pg gem to my gemfile
我将pg gem添加到我的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
?
当我使用bundle install时,如何做到这一点?
4 个解决方案
#1
79
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
更多信息可以在bundle config man页面中找到
#2
15
Run 'bundle config' before 'bundle install' to set the parameters, i.e.:
在“bundle install”之前运行“bundle config”设置参数,即:
bundle config build.pg --with-pg-config=/path/to/pg_config
bundle install
#3
9
with Rails3 and PostgreSQL. I do like this
Rails3和PostgreSQL。我非常喜欢这
>rails new test_app -d postgreSQL
>cd test_app
>mkdir .bundle
>echo "BUNDLE_BUILD__PG: --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config" > .bundle/config
>bundle install
so you can keep config in source control.
因此,您可以在源代码控制中保留配置。
for user's profile
对用户的资料
bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config
this will create ~/.bundle/config file.
这将创建~ /。包/配置文件。
#4
0
If you're using Ruby 2.x and up, then thrift 0.9.0 can't build with it. see https://issues.apache.org/jira/browse/THRIFT-2219. Thrift 0.9.2 is fixed.
如果您正在使用Ruby 2。x和上面,然后节约0。9。0不能用它。见https://issues.apache.org/jira/browse/thrift - 2219。节俭0.9.2是固定的。
Try installing: gem install rbhive -v 1.0.3.pre
尝试安装:gem安装rbhive - v1.0.3 .pre
#1
79
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
更多信息可以在bundle config man页面中找到
#2
15
Run 'bundle config' before 'bundle install' to set the parameters, i.e.:
在“bundle install”之前运行“bundle config”设置参数,即:
bundle config build.pg --with-pg-config=/path/to/pg_config
bundle install
#3
9
with Rails3 and PostgreSQL. I do like this
Rails3和PostgreSQL。我非常喜欢这
>rails new test_app -d postgreSQL
>cd test_app
>mkdir .bundle
>echo "BUNDLE_BUILD__PG: --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config" > .bundle/config
>bundle install
so you can keep config in source control.
因此,您可以在源代码控制中保留配置。
for user's profile
对用户的资料
bundle config build.pg --with-pg-config=/opt/local/lib/postgresql91/bin/pg_config
this will create ~/.bundle/config file.
这将创建~ /。包/配置文件。
#4
0
If you're using Ruby 2.x and up, then thrift 0.9.0 can't build with it. see https://issues.apache.org/jira/browse/THRIFT-2219. Thrift 0.9.2 is fixed.
如果您正在使用Ruby 2。x和上面,然后节约0。9。0不能用它。见https://issues.apache.org/jira/browse/thrift - 2219。节俭0.9.2是固定的。
Try installing: gem install rbhive -v 1.0.3.pre
尝试安装:gem安装rbhive - v1.0.3 .pre