gpt4 book ai didi

ruby-on-rails - 对于 Mac OS X 10.9.1,将 pg gem 从 0.17.0 更新到 0.17.1 时出错

转载 作者:行者123 更新时间:2023-11-29 11:40:41 27 4
gpt4 key购买 nike

只是做了一个简单的 bundle update 并得到了一个与 PostgreSQL 的 pg gem 相关的恼人错误。我的系统上没有安装 PostgreSQL(除非它是为 Mac OS X 10.9.1 自动安装的)。这在以前从来都不是问题。有什么想法吗?

Using jquery-rails (3.0.4) 
Using jquery-rails-cdn (1.0.1)
Installing liquid (2.6.1)
Using paperclip (3.5.2)
Installing pg (0.17.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/scott/.rvm/rubies/ruby-1.9.3-p194/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
--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=/Users/scott/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--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 /Users/scott/.rvm/gems/ruby-1.9.3-p194@ucode/gems/pg-0.17.1 for inspection.
Results logged to /Users/scott/.rvm/gems/ruby-1.9.3-p194@ucode/gems/pg-0.17.1/ext/gem_make.out

An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.


$ gem list pg

*** LOCAL GEMS ***

pg (0.17.0, 0.16.0, 0.15.1, 0.15.0, 0.14.1)

更新:根据要求,这是我的mkmf.log文件

find_executable: checking for pg_config... -------------------- no

--------------------

find_header: checking for libpq-fe.h... -------------------- no

"/usr/bin/gcc-4.2 -o conftest -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin12.2.0 -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/mpapis/.rvm/rubies/ruby-1.9.3-p194/include -fno-common -pipe conftest.c -L. -L/Users/scott/.rvm/rubies/ruby-1.9.3-p194/lib -L. -L/Users/mpapis/.rvm/rubies/ruby-1.9.3-p194/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/Users/mpapis/.rvm/rubies/ruby-1.9.3-p194/lib'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

"/usr/bin/gcc-4.2 -E -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/x86_64-darwin12.2.0 -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/backward -I/Users/scott/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Users/mpapis/.rvm/rubies/ruby-1.9.3-p194/include -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */

--------------------

更新 2:我的 Gemfile 中唯一提到的 pg 在这里:

group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end

最佳答案

最简单的方法是安装Postgres.app .

然后做:

$ gem install pg -v '0.17.1' && bundle update

编辑:不要忘记 add the relevant directories into your PATH .

关于ruby-on-rails - 对于 Mac OS X 10.9.1,将 pg gem 从 0.17.0 更新到 0.17.1 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21301372/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com