我使用的是Mac。如果我运行的是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的方法,但我需要这样做。
发布于 2011-03-20 04:35:56
您的Gemfile.lock中是否列出版本0.10.0?如果是这样的话,假设您的Gemfile没有指定版本0.10.0,那么您应该能够通过运行bundle update pg来更新Rails正在查找的版本。
https://stackoverflow.com/questions/5364718
复制相似问题