在osx上安装pg gem时出错 [英] Error installing pg gem on osx

查看:94
本文介绍了在osx上安装pg gem时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在osx 10.6.7上试图在一个新的rails 3.0.7应用上运行bundle install,并且在尝试构建pg gem时仍然失败。它一直告诉我,我需要开发人员工具。但据我所知,我已安装了开发人员工具。



以下是xcodebuild的版本--version

  Xcode 3.2.6 
组件版本:DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion:10M2518

以下是失败的pg gem build

  /Users/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with -pg-config = / Library / PostgreSQL / 8.4 / bin / pg_config 
使用/Library/PostgreSQL/8.4/bin/pg_config中的配置值
检查libpq-fe.h ... *** extconf.rb失败***
由于某种原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

提供的配置选项:
--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 / bm / .rvm / rubies / ruby​​-1.9.2-head / bin / ruby​​
--with-pg
- -without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include = $ {pg-dir} / include
--with-pg-lib
--without-pg-lib = $ {pg-dir} / lib $ b $ --with-pg-config
/Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in`try_do':编译器未能生成可执行文件。 (RuntimeError)
您必须先安装开发工具。来自/ Users / bm的/Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in`try_cpp'
中的
/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:853:in`block in find_header'
from /Users/bm/.rvm/rubies/ruby -1.9.2-head / lib / ruby​​ / 1.9.1 / mkmf.rb:693:在`block in checking_for'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/ lib / ruby​​ / 1.9.1 / mkmf.rb:280:在`block(2 levels)推迟'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby /1.9.1/mkmf.rb:254:in`open'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb: 280:在`block in postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in`open'$ b / b from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in`postpone'
from / Users / bm / .rvm / rubies / ruby​​-1.9.2-head / lib / ruby​​ / 1.9.1 / mkmf.rb:692:来自/Users/bm/.rvm/rubies/ruby-1.9的`checking_for'
。 2-head / lib / ruby​​ / 1.9.1 / mkmf.rb:852:在`find_header
from extconf.rb:31:in< main>'


Gem文件将保持安装在/Users/bm/.rvm/gems/ruby-1.9中。 2-head@rc_search/gems/pg-0.11.0进行检查。
结果记录到/Users/bm/.rvm/gems/ruby-1.9.2-head@rc_search/gems/pg-0.11.0/ext/gem_make.out
from / Users / bm / .rvm / rubies / ruby​​-1.9.2-head / lib / ruby​​ / 1.9.1 / ruby​​gems / installer.rb:486:在`block in build_extensions'
from /Users/bm/.rvm/rubies/ ruby-1.9.2-head / lib / ruby​​ / 1.9.1 / ruby​​gems / installer.rb:446:来自/Users/bm/.rvm/rubies/ruby-1.9.2-head的`each'
/lib/ruby/1.9.1/rubygems/installer.rb:446:in`build_extensions'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9。 1 / ruby​​gems / installer.rb:198:在`install'中$ / $ b / from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler /source.rb:100:从`/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer'安装
。 rb:55:在`block in run'中
来自/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/spec_set.rb :12:从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/li开始在每个'
中的块中b / bundler / spec_set.rb:12:来自/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler的`each'
/spec_set.rb:12:在/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer中的每个
中。 rb:44:在`run'中运行
从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer.rb:8 :从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in`安装'
`从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in安装'
'从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118'运行'
:从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in'invoke_task'
从/Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389下载`
'在`sta rt'
from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/bin/bundle:13:in`< top(required)> ;'来自/Users/bm/.rvm/的/Users/bm/.rvm/gems/ruby-1.9.2-head@global/bin/bundle:19:in`load'
中的
gems/ruby-1.9.2-head@global/bin/bundle:19:在< main>'

任何帮助将非常感激。仅供参考我也尝试用mysql构建应用程序,基本上获得了相同的堆栈。所以我很确定我错过了某种开发人员构建工具,但我只是不知道哪些工具。 :(


解决方案我在安装Rails应用程序时遇到了完全相同的问题,我安装了自制程序,然后运行

p>

  brew install postgresql。

终于正确安装了postgres,问题已解决。


I am on osx 10.6.7 trying to run bundle install on a new rails 3.0.7 app and it keeps failing when trying to build the pg gem. It keeps telling me that I have need the developer tools. But as far as I can tell I have the developer tools installed.

Here is the output of xcodebuild -version

Xcode 3.2.6
Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518

Here is the output of the failed pg gem build

/Users/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config
Using config values from /Library/PostgreSQL/8.4/bin/pg_config
checking for libpq-fe.h... *** 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/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby
    --with-pg
    --without-pg
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib
    --with-pg-config
/Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
    from extconf.rb:31:in `<main>'


Gem files will remain installed in /Users/bm/.rvm/gems/ruby-1.9.2-head@rc_search/gems/pg-0.11.0 for inspection.
Results logged to /Users/bm/.rvm/gems/ruby-1.9.2-head@rc_search/gems/pg-0.11.0/ext/gem_make.out
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
    from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `block in run'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `block in each'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/gems/bundler-1.0.0/bin/bundle:13:in `<top (required)>'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/bin/bundle:19:in `load'
    from /Users/bm/.rvm/gems/ruby-1.9.2-head@global/bin/bundle:19:in `<main>'

Any help would be immensely appreciated. FYI I also tried building the app with a mysql and essentially got the same stack. So I'm pretty sure I'm missing some sort of developer build tools, but I just don't know which ones. :(

解决方案

I had the exact same problem when running bundle install in a Rails app. I installed homebrew and then ran

brew install postgresql. 

That finally installed postgres correctly and the issue was fixed for me.

这篇关于在osx上安装pg gem时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆