无法安装Compass

11

上周我更新了cygwin,因为bash存在“漏洞问题”。
然后我无法编译sass了。
我尝试重新安装ruby,在一些安装失败和重新安装cygwin之后我安装了它并使用“gem update --system”进行了更新。
它运行正常,但当我尝试安装compass时,我收到了以下消息:

> /usr/bin/ruby.exe -r ./siteconf20141006-7856-1td7wzb.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=/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  /usr/share/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
> /usr/share/ruby/2.0.0/mkmf.rb:565:in `try_cpp'  from
> /usr/share/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'  from
> /usr/share/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'  from
> /usr/share/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone' 
> from /usr/share/ruby/2.0.0/mkmf.rb:310:in `open'  from
> /usr/share/ruby/2.0.0/mkmf.rb:340:in `block in postpone'  from
> /usr/share/ruby/2.0.0/mkmf.rb:310:in `open'  from
> /usr/share/ruby/2.0.0/mkmf.rb:336:in `postpone'  from
> /usr/share/ruby/2.0.0/mkmf.rb:894:in `checking_for'  from
> /usr/share/ruby/2.0.0/mkmf.rb:1043:in `have_header'  from
> extconf.rb:16:in `<main>'
> 
> extconf failed, exit code 1
我尝试安装ffi ("gem install ffi" 和 "gem install ffi --pre"),但是我得到了相同的消息。
这是日志(.gem/ruby/extensions/x86_64-cygwin/ffi-1.9.5/gem_make.out)。
package configuration for libffi is not found 
"gcc -o conftest.exe -I/usr/include/ruby-2.0.0 -I/usr/include/ruby-2.0.0/ruby/backward -I/usr/include/ruby-2.0.0 -I. -ggdb -O2 -pipe -Wimplicit-function-declaration conftest.c -L. -L/usr/lib -L. -fstack-protector -lruby200 -lpthread -lrt -ldl -lcrypt " 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: int main(int argc, char **argv) 
4: { 
5: return 0; 
6: } 
/* end */

我真的很沮丧!!'

系统 Windows 7 64位 Cygwin


我知道已经有一段时间了,但是你找到解决这个问题的方法了吗? - Fred
5个回答

30

对我来说,只需要使用gcc环境,所以你可以试试

sudo apt-get install gcc

那在Ubuntu上对我有效 :)


对于CentOS, yum install gcc - Zhang Buzz
10
我必须使用 sudo apt-get install make 命令安装 make 工具,除了 gcc 之外。 - Faisal Feroz
阅读问题。Kornking的操作系统是Windows。 - Ethan Reesor

4
确保已安装Xcode。
xcode-select --install

如果已经安装,请确保您已经接受了服务条款。
sudo xcodebuild -license

向下滚动到底部并键入“同意”。

按照以上步骤应该可以运行。

如果在执行以上两个步骤后出现以下问题:

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/compass

请尝试以下操作。

sudo su
sudo gem install -n /usr/local/bin compass

如果你真的读了问题,你会注意到Kornking的系统是Windows。所以...没有XCode。 - Ethan Reesor

3
在OSX上,这个方法可以起作用: 如果gem install compass失败,请尝试 gem install ffi 如果这也失败了,那么错误似乎是ffi构建在/usr/bin中寻找gcc-4.2, 如果您已经安装了gcc,只需通过键入在/usr/bin中创建符号链接 sudo ln -s gcc gcc-4.2 否则,您可能需要先安装gcc(谷歌一下)。

0

0

这是非常老的帖子,但由于我曾经在尝试解决相同问题时挣扎了很长时间,所以我认为它可能对其他人有所帮助...

最终对我有效的方法是:卸载 Ruby 3.1.x 并使用此处提供的 rubyinstaller-devkit-2.7.5-1-x64.exe 重新安装:https://rubyinstaller.org/downloads/

确保在最后安装 devTools。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接