无法设置 ruby​​ 环境 - 安装 fii gem 错误 [英] can't setup ruby environment - installing fii gem error

查看:16
本文介绍了无法设置 ruby​​ 环境 - 安装 fii gem 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 ruby​​ 项目设置环境.但是当我运行 'bundle' 时,我在安装 'fii' gem 时出错:

<上一页><代码>安装 ffi (1.8.1)Gem::Installer::ExtensionBuildError: 错误: 无法构建 gem 原生扩展./Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb检查 ffi.h... *** extconf.rb 失败 ***由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件.查看 mkmf.log 文件了解更多信息细节.您可能需要配置选项./Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do':编译器无法生成可执行文件.(运行时错误)您必须先安装开发工具.Gem 文件将继续安装在/Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1 以供检查.结果记录到/Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1/ext/ffi_c/gem_make.out安装 ffi (1.8.1) 时出错,Bundler 无法继续.在捆绑之前确保 `gem install ffi -v '1.8.1'` 成功.

我的环境:

  • OS_X 10.8.4

  • 红宝石 1.9.3p448

  • Xcode 4.6.3

  • libffi-3.0.13

请帮我解决它.

解决方案

确保你已经安装了 Apple Xcode 和命令行工具(看这个截图):

https://developer.apple.com/technologies/tools/

之后,别忘了安装 libffi.

1) 如果您使用的是自制软件

brew install libffi

2) 如果您使用的是 macport

sudo 端口安装 libffi

I'm trying to setup environtment for ruby project. But when I run 'bundle', I have error during installing 'fii' gem:


    Installing ffi (1.8.1) 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
    checking for ffi.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.

    /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
    You have to install development tools first.

    Gem files will remain installed in /Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1 for inspection.
    Results logged to /Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1/ext/ffi_c/gem_make.out

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


My environment:

  • OS_X 10.8.4

  • ruby 1.9.3p448

  • Xcode 4.6.3

  • libffi-3.0.13

Please, help me to fix it.

解决方案

Make sure that you have installed Apple Xcode and Command Line Tools (look at this screenshot):

https://developer.apple.com/technologies/tools/

After that, don't forget to install libffi.

1) if you are using homebrew

brew install libffi

2) if you are using macport

sudo port install libffi

这篇关于无法设置 ruby​​ 环境 - 安装 fii gem 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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