无法通过rvm bundle install安装ffi 1.9.0 - OSX 10.8.4

时间:2013-08-24 21:59:50

标签: ruby macos rvm ffi

在Macbook Pro上使用带有自制程序,xcode(带命令行工具)和libffi的OSX 10.8.4。

我已经安装了rvm和ruby-1.9.3-p448并且有一个名为omega.ecoop的gemset。有一个gemfile,列出了这个项目所需的宝石。但是,在运行捆绑检查后,我无法安装它们:

Bundler can't satisfy your Gemfile's dependencies.

这是正确的,因为它们未安装。所以我用:

bundle install

产生以下内容:

Sams-MacBook-Pro:ecoop Sam$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.5) 
Using chunky_png (1.2.8) 
Using fssm (0.2.10) 
Using sass (3.2.10) 
Using compass (0.12.2) 
Using breakpoint (2.0.6) 
Using coderay (1.0.9) 
Using compass-blend-modes (0.0.2) 
Using color-schemer (0.2.5) 
Using compass-normalize (1.4.3) 
Using compass-rgbapng (0.2.1) 
Using compass-validator (3.0.1) 
Using css_parser (1.3.5) 
Using eventmachine (1.0.3) 
Using http_parser.rb (0.5.3) 
Using em-websocket (0.5.0) 
Installing ffi (1.9.0) 

一切顺利,直到:

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

    /Users/Sam/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile

make
mkdir -p "/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64; (if [ ! -f "/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64/Makefile ]; then echo "Configuring libffi for x86_64"; cd "/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64 && env CC=" gcc-4.6" CFLAGS="-arch x86_64 " LDFLAGS="-arch x86_64" "/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c/libffi"/configure --disable-static --with-pic=yes --disable-dependency-tracking --host=x86_64-apple-darwin > /dev/null; fi); env MACOSX_DEPLOYMENT_TARGET=10.4 make -C "/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64
Configuring libffi for x86_64
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
configure: error: in `/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c/libffi-x86_64':
configure: error: C compiler cannot create executables
See `config.log' for more details
make[1]: *** No targets specified and no makefile found.  Stop.
make: *** ["/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c"/libffi-x86_64/.libs/libffi_convenience.a] Error 2


Gem files will remain installed in /Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0 for inspection.
Results logged to /Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.9.0/ext/ffi_c/gem_make.out

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

这个命令也不起作用(gem install ffi -v'1.9.0'),我得到了同样的错误。我试过了:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

我读过:

can't setup ruby environment - installing fii gem error

Bundle update fails on ffi

Bundle update fails on ffi

Error installing ffi

gem install ffi -v '1.1.5' osx 10.8

但仍然没有运气。我按照本指南设置了RVM:

http://portertech.ca/2010/03/26/homebrew--rvm--awesome/

如果这有帮助,ffi-1.0.11无故障安装,将无法安装fff-1.9.0(http://rubygems.org/gems/ffi/versions)。

/Users/Sam/.rvm/gems/ruby-1.9.3-p448@omega.ecoop/gems/ffi-1.0.11 (no problem)

我只想使用命令行(而不是珠宝盒GUI)来学习一些新的技能但是相当困在这里。任何帮助将不胜感激,谢谢。

修改

所以我尝试了一种不同的方法,我想也许是ruby的版本不兼容:

rvm install 2.0.0

然后使用ruby 2.0.0创建gemset

rvm use 2.0.0@omega.ecoop --create

检查它并选择当前的gemset(准备安装一些宝石)

rvm gemset list

gemsets for ruby-2.0.0-p247 (found in /Users/Sam/.rvm/gems/ruby-2.0.0-p247)
(default)
global
=> omega.ecoop

是的,一切都很好。尝试并安装

bundle install

Sams-MacBook-Pro:ecoop Sam$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing addressable (2.3.5) 
Installing chunky_png (1.2.8) 
Installing fssm (0.2.10) 
Installing sass (3.2.10) 
Installing compass (0.12.2) 
Installing breakpoint (2.0.6) 
Installing coderay (1.0.9) 
Installing compass-blend-modes (0.0.2) 
Installing color-schemer (0.2.5) 
Installing compass-normalize (1.4.3) 
Installing compass-rgbapng (0.2.1) 
Installing compass-validator (3.0.1) 
Installing css_parser (1.3.5) 
Installing eventmachine (1.0.3) 
Installing http_parser.rb (0.5.3) 
Installing em-websocket (0.5.0) 
Installing ffi (1.9.0)
Installing formatador (0.2.4) 
Installing rb-fsevent (0.9.3) 
Installing rb-inotify (0.9.1) 
Installing rb-kqueue (0.2.0) 
Installing listen (1.3.0) 
Installing lumberjack (1.0.4) 
Installing method_source (0.8.2) 
Installing slop (3.4.6) 
Installing pry (0.9.12.2) 
Installing thor (0.18.1) 
Installing guard (1.8.2) 
Installing guard-compass (0.0.8) 
Installing multi_json (1.7.9) 
Installing guard-livereload (1.4.0) 
Installing guard-shell (0.5.1) 
Installing oily_png (1.1.0) 
Installing rb-fchange (0.0.6) 
Installing sass-globbing (1.1.0) 
Installing sassy-strings (1.0.0) 
Installing singularitygs (1.1.2) 
Installing susy (1.0.9) 
Installing toolkit (1.3.7) 
Installing yajl-ruby (1.1.0) 
Using bundler (1.3.5) 
Your bundle is complete!

这次'安装ffi(1.9.0)'没问题。然后我删除了ruby 1.9.3,因为我现在只用它来指南针/ sass / susy,如果2.0.0工作,那就这样吧。

Sams-MacBook-Pro:~ Sam$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
Sams-MacBook-Pro:~ Sam$ cd drupal/ecoop/sites/default/themes/ecoop/
ruby-1.9.3-p448 is not installed.

To install do: 'rvm install ruby-1.9.3-p448' <<<<<< no thanks

Sams-MacBook-Pro:ecoop Sam$ compass watch
>>> Change detected at 12:35:09 to: reset.scss
overwrite css/reset.css 
overwrite css/styles.css 
>>> Compass is watching for changes. Press Ctrl-C to Stop.

现在适用于我的项目。不确定使用更新版本的红宝石但已经失去足够时间的任何后果,需要做一些设计。显然,这不会帮助需要1.9.3的人,因此原始查询ffi无法安装的原因尚未得到解决。

4 个答案:

答案 0 :(得分:1)

Sams-MacBook-Pro:~ Sam$ cd drupal/ecoop/sites/default/themes/ecoop/
ruby-1.9.3-p448 is not installed.

To install do: 'rvm install ruby-1.9.3-p448' <<<<<< no thanks

该目录中的.ruby-version文件仍为1.9.3。

答案 1 :(得分:1)

我的两分钱 - 好吧,tuppenny。

在第11步之前运行bundle install时尝试install an Omega 4 subtheme in Drupal时遇到了这个问题(指南中没有提到......叹息)。

Omega有大量名为{{ THEME }}的占位符,它们将被您的自定义主题名称替换 - 并且不知何故(原谅我,因为我对Ruby一无所知!)它试图使用这个奇怪的占位符和空格的Gemfile。

它还尝试将宝石保存到我认为很糟糕的文件夹/home/ubuntu/.rvm/gems/ruby-1.9.3-p547@omega.{{ THEME }}/gems

要解决此问题,我执行了以下操作:

rvm use 1.9.3-p547@omega.subthemename --create
rvm gemset list

  gemsets for ruby-1.9.3-p547 (found in /home/ubuntu/.rvm/gems/ruby-1.9.3-p547)
     (default)
     global
  => omega.mysubtheme
     omega.{{ THEME }}

bundle install # This now works!

希望这有助于某人!结论是,这通常是某个文件名空间的问题 - 很多人都遇到了OSX的问题,因为它解决了通往&#34; Macintosh HD&#34;这是一个无效的名称。

答案 2 :(得分:0)

您需要确保已安装 gcc46

尝试brew install gcc46,然后重新运行bundle install

答案 3 :(得分:0)

通常当我遇到此问题时,解决方案是确保更新Xcode。