2015-04-01 129 views
0

我在mac(yosmite)和终端上试图安装指南针,所以我可以开始使用sass。我运行:麻烦安装指南针为sass/scss

sudo gem install compass 

,并获得这个巨大的错误:

Caspars-MBP:~ casparwylie$ sudo gem install compass 
Building native extensions. This could take a while... 
ERROR: Error installing compass: 
    ERROR: Failed to build gem native extension. 

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150401-47466-qqmsir.rb 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. 

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/2.0/usr/bin/ruby 
    --with-ffi_c-dir 
    --without-ffi_c-dir 
    --with-ffi_c-include 
    --without-ffi_c-include=${ffi_c-dir}/include 
    --with-ffi_c-lib 
    --without-ffi_c-lib=${ffi_c-dir}/ 
    --with-libffi-config 
    --without-libffi-config 
    --with-pkg-config 
    --without-pkg-config 
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header' 
    from extconf.rb:16:in `<main>' 

extconf failed, exit code 1 

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.8 for inspection. 
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/ffi-1.9.8/gem_make.out 

有谁知道什么可能是怎么回事?

谢谢。

回答

0

不知道如何在Mac上解决(也许brew?如果可能的话,与红宝石安装相同的方式),但在Linux(xubuntu)这里有同样的问题。解决如下:

$ sudo apt-get install ruby-dev && libffi-dev 
... 
$ sudo gem install ffi 
Building native extensions. This could take a while... 
Successfully installed ffi-1.9.8 
Parsing documentation for ffi-1.9.8 
Installing ri documentation for ffi-1.9.8 
Done installing documentation for ffi after 0 seconds 
1 gem installed 

整理过指南针这


后后快速搜索MAC(ref):

$ brew install pkg-config libffi 

它可能不够用,但不要有我的mac atm来试用它