Rails想要pg 0.10.0,但我只能安装pg 0.10.1

时间:2011-03-19 20:31:42

标签: ruby-on-rails ruby-on-rails-3 rubygems

我在Mac OS X上。如果我运行sudo env ARCHFLAGS="-arch i386" gem install pg,它就可以了。但是,当我尝试在浏览器中访问我的Rails项目时出现此错误:

Could not find pg-0.10.0 in any of the sources (Bundler::GemNotFound)

如果我然后卸载0.10.1并尝试安装0.10.0,我得到这个:

$ sudo env ARCHFLAGS="-arch i386" gem install pg --version 0.10.0
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pg_config... yes
Ruby cflags: "-arch i386 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common  "
MacOS X build: fixing architecture flags:
  using the value in ARCHFLAGS environment variable ("-arch i386").
  finding flags common to both Ruby and PostgreSQL...
  testing for architecture: "ppc"
  testing for architecture: "i386"
  common arch flags: -arch i386
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
    --without-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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    --with-pg
    --without-pg
    --with-pg-config
    --without-pg-config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.10.0/ext/gem_make.out

我不在乎我是否找到了让Rails接受pg 0.10.1的方法,或者我是否找到了安装pg 0.10.0的方法,但我需要做一个或另一个。

1 个答案:

答案 0 :(得分:1)

Gemfile.lock中是否列出了0.10.0版本?如果是这样,您应该能够通过运行bundle update pg来更新Rails正在寻找的版本,假设您的Gemfile未指定版本0.10.0。