当我试图安装最新版本的compass (https://rubygems.org/gems/compass/versions/1.0.0.alpha.17)时,我得到以下错误。

ERROR:  Error installing compass:
ERROR: Failed to build gem native extension.

 ERROR:  Error installing compass:
  ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... yes
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... 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 "DESTDIR=" clean

make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:303:5: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
    rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
    ^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
                                      ^
1 warning generated.
compiling ClosurePool.c
compiling DataConverter.c
DataConverter.c:43:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling DynamicLibrary.c
compiling ffi.c
compiling Function.c
Function.c:479:33: warning: incompatible pointer types passing 'VALUE (void *)' to parameter of type 'void *(*)(void *)' [-Wincompatible-pointer-types]
        rb_thread_call_with_gvl(callback_with_gvl, &cb);
                                ^~~~~~~~~~~~~~~~~
Function.c:102:46: note: passing argument to parameter 'func' here
extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
                                             ^
Function.c:563:9: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration]
        rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w);
        ^
Function.c:738:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
3 warnings generated.
compiling FunctionInfo.c
compiling LastError.c
compiling LongDouble.c
compiling MappedType.c
compiling MemoryPointer.c
compiling MethodHandle.c
compiling Platform.c
compiling Pointer.c
compiling Struct.c
compiling StructByReference.c
compiling StructByValue.c
compiling StructLayout.c
compiling Thread.c
compiling Type.c
compiling Types.c
compiling Variadic.c
linking shared-object ffi_c.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [ffi_c.bundle] Error 1

make failed, exit code 2

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

这是怎么回事?如何正确安装最新的指南针?


当前回答

我为你这个问题纠结了大约3个小时。从Compass 1.0开始。Alpha19,需求是RVM版本1.9.3。

有几个未收集的帖子,但对我有用的是以下几点:

Sudo gem卸载sass 须藤宝石卸载罗盘 RVM安装ruby-1.9.3-p448 Sudo gem安装sass—pre Sudo宝石安装指南针-pre

这样就成功了。希望它也适用于你!

其他回答

试试这个,然后再试着安装指南针

apt-get install ruby-dev

在Mac OS上你需要安装这个功能!

xcode-select --install

我在Linux Mint上也有同样的问题,但我能够通过卸载ruby并重新安装来修复它。

ruby:卸载

sudo apt-get remove ruby

它报告了一些ruby包,比如:

Package 'ruby' is not installed, so not removed
The following packages were automatically installed and are no longer required:
libruby2.2 ruby-chunky-png ruby-sass rubygems-integration
Use 'apt-get autoremove' to remove them.

卸载剩余软件包*

apt-get autoremove

重新安装ruby

sudo apt-get install ruby2.2

安装指南针

sudo gem install compass

最后一条命令执行成功。

嗨,这是一个挑战,让它在Mac上工作,所以不管怎样,这里有一个解决方案

安装macports 安装区 重启终端 先执行rvm requirements命令,再执行rvm install 2.1命令 最后一步是运行gem install compass—pre

我不确定,但是Mavericks上的ruby版本不支持本地扩展等等…所以如果你指向其他ruby版本,比如我做的“2.1”,它可以正常工作。

在优胜美地,你所要做的就是安装命令行工具。这样就有用了。

即使其他宝石安装好了。你必须运行xcode-select——install来安装gem compass。

祝你好运。