如何在Apple Silicon M2上安装ffi版本1.11.1

问题描述 投票:0回答:1

我正在尝试使用捆绑安装来安装

ffi 1.11.1
,但出现此错误:

An error occurred while installing ffi (1.11.1), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.11.1' --source 'http://rubygems.org/'` succeeds before bundling.

In Gemfile:
  spree was resolved to 3.1.3, which depends on
    spree_backend was resolved to 3.1.3, which depends on
      bootstrap-sass was resolved to 3.3.7, which depends on
        sass was resolved to 3.7.4, which depends on
          sass-listen was resolved to 4.0.0, which depends on
            rb-inotify was resolved to 0.10.0, which depends on
              ffi

所以我按照它的要求做了。我运行命令:

gem install ffi -v '1.11.1' --source 'http://rubygems.org/'

然后得到这个错误:

Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
    ERROR: Failed to build gem native extension.

    current directory: /Users/marialuisagako/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/ffi-1.11.1/ext/ffi_c
/Users/marialuisagako/.rbenv/versions/2.3.6/bin/ruby -r ./siteconf20231230-1767-1obffxv.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_closure_alloc()... yes
checking for shlwapi.h... no
checking for rb_thread_call_without_gvl()... yes
checking for ruby_native_thread_p()... yes
checking for ruby_thread_has_gvl_p()... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/marialuisagako/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/extensions/-darwin-23/2.3.0-static/ffi-1.11.1/mkmf.log

current directory: /Users/marialuisagako/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/ffi-1.11.1/ext/ffi_c
make "DESTDIR=" clean

current directory: /Users/marialuisagako/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/ffi-1.11.1/ext/ffi_c
make "DESTDIR="
compiling Thread.c
compiling Buffer.c
Buffer.c:266:45: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little"));
                                            ^~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Buffer.c:266:45: note: '{' token is here
        return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little"));
                                            ^~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Buffer.c:266:45: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little"));
                                            ^~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }

    ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Buffer.c:266:72: note: ')' token is here
        return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little"));
                                                                       ^~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Buffer.c:276:23: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            if (id == rb_intern("little")) {
                      ^~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
Buffer.c:276:23: note: '{' token is here
            if (id == rb_intern("little")) {
                      ^~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
Buffer.c:276:23: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            if (id == rb_intern("little")) {
                      ^~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
Buffer.c:276:23: note: ')' token is here
            if (id == rb_intern("little")) {
                      ^~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
Buffer.c:279:30: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            } else if (id == rb_intern("big") || id == rb_intern("network")) {
                             ^~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
Buffer.c:279:30: note: '{' token is here
            } else if (id == rb_intern("big") || id == rb_intern("network")) {
                             ^~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
Buffer.c:279:56: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            } else if (id == rb_intern("big") || id == rb_intern("network")) {
                                                       ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
Buffer.c:279:56: note: ')' token is here
            } else if (id == rb_intern("big") || id == rb_intern("network")) {
                                                       ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
10 warnings generated.
compiling DynamicLibrary.c
compiling Variadic.c
Variadic.c:114:47: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
    convention = rb_hash_aref(options, ID2SYM(rb_intern("convention")));
                                              ^~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Variadic.c:114:47: note: '{' token is here
    convention = rb_hash_aref(options, ID2SYM(rb_intern("convention")));
                                              ^~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \

                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
Variadic.c:132:52: note: ')' token is here
        VALUE typeName = rb_funcall2(rbReturnType, rb_intern("inspect"), 0, NULL);
                                                   ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
Variadic.c:147:49: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
Variadic.c:147:49: note: '{' token is here
            VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
Variadic.c:147:49: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
            VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
Variadic.c:147:49: note: ')' token is here
            VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL);
                                                ^~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
Variadic.c:159:63: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
    rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map"))));
                                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Variadic.c:159:63: note: '{' token is here
    rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map"))));
                                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Variadic.c:159:63: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
    rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map"))));
                                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1723:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    }
    ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Variadic.c:159:63: note: ')' token is here
    rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map"))));
                                                              ^~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:406:29: note: expanded from macro 'ID2SYM'
#define ID2SYM(x) RB_ID2SYM(x)
                            ^
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:401:33: note: expanded from macro 'RB_ID2SYM'
#define RB_ID2SYM(x) (rb_id2sym(x))
                                ^
Variadic.c:204:56: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
                rbType = rb_const_get(rbffi_TypeClass, rb_intern("INT32"));
                                                       ^~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:23: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                      ^
Variadic.c:204:56: note: '{' token is here
                rbType = rb_const_get(rbffi_TypeClass, rb_intern("INT32"));
                                                       ^~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:24: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1726:37: note: expanded from macro 'CONST_ID_CACHE'
#define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1718:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
Variadic.c:204:56: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
                rbType = rb_const_get(rbffi_TypeClass,                          
                                    
MemoryPointer.c:165:21: note: ')' token is here
    rb_funcall(obj, rb_intern("put_string"), 2, INT2FIX(0), s);
                    ^~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
2 warnings generated.
compiling Platform.c
compiling LongDouble.c
LongDouble.c:24:43: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
        return rb_funcall(rb_cBigDecimal, rb_intern("new"), 1, rb_str_new(buf, sprintf(buf, "%.35Le", ld)));
                                          ^~~~~~~~~~~~~~~~
                                                        
                      ^
LongDouble.c:38:64: note: '{' token is here
    if (!RTEST(rb_cBigDecimal) && rb_const_defined(rb_cObject, rb_intern("BigDecimal"))) {
                                                                                              
Function.c:912:22: warning: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
    id_from_native = rb_intern("from_native");

    ^
Function.c:912:22: note: ')' token is here
    id_from_native = rb_intern("from_native");
                     ^~~~~~~~~~~~~~~~~~~~~~~~
/Users/marialuisagako/.rbenv/versions/2.3.6/include/ruby-2.3.0/ruby/ruby.h:1733:51: note: expanded from macro 'rb_intern'
        __extension__ (CONST_ID_CACHE((ID), (str))) : \
                                                  ^
10 warnings and 1 error generated.
make: *** [Function.o] Error 1

make failed, exit code 2

曾经修复但无法修复的链接:

https://github.com/ffi/ffi/issues/814

如何在M1 Mac上安装和运行ffi

错误:安装 ffi 时出错:错误:无法构建 gem 本机扩展

我还添加了通过brew安装的

libffi
,但仍然无法工作。

我也尝试过链接

ln -s /usr/local//Cellar/libffi/3.3/include/ffi.h /usr/local/include/ffi.h

ln -s /usr/local//Cellar/libffi/3.3/include/ffitarget.h /usr/local/include/ffitarget.h

但我收到错误

/usr/local/include/ffi.h no such file


红宝石版本:

ruby 2.3.6p384 (2017-12-14 revision 61254) [-darwin23]

ruby-on-rails ruby rubygems homebrew
1个回答
1
投票

我运行了这个并且它起作用了:

gem install ffi -v '1.11.1' -- --with-cflags="-Wno-error=implicit-function-declaration"
© www.soinside.com 2019 - 2024. All rights reserved.