备份 gem 安装失败

Backup gem installation failed

  OS: macOS Big Sur
  Ruby:  2.7.2
  Rails: 6.0.3.6

当我尝试安装备份 gem 时,出现以下错误

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

current directory: /Users/devi/.rvm/gems/ruby-2.7.2/gems/atomic-1.1.14/ext
/Users/devi/.rvm/rubies/ruby-2.7.2/bin/ruby -I /Users/devi/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0 -r ./siteconf20210402-90276-tab873.rb extconf.rb
creating Makefile
current directory: /Users/devi/.rvm/gems/ruby-2.7.2/gems/atomic-1.1.14/ext
make DESTDIR\= clean

current directory: /Users/devi/.rvm/gems/ruby-2.7.2/gems/atomic-1.1.14/ext
make DESTDIR\=
compiling atomic_reference.c
atomic_reference.c:23:12: warning: 'rb_data_object_alloc' is deprecated: by rb_data_object_wrap [-Wdeprecated-declarations]
return rb_data_object_alloc(klass, (void *) Qnil, ir_mark, NULL);
       ^
/Users/devi/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/ruby/ruby.h:1452:1: note: 'rb_data_object_alloc' has been explicitly marked deprecated here
DEPRECATED_BY(rb_data_object_wrap, static inline VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC));
^
/Users/devi/.rvm/rubies/ruby-2.7.2/include/ruby-2.7.0/arm64-darwin20/ruby/config.h:139:44: note: expanded from macro 'DEPRECATED_BY'
#define DEPRECATED_BY(n,x) __attribute__ ((__deprecated__("by "#n))) x
                                       ^
atomic_reference.c:53:9: error: implicit declaration of function 'OSAtomicCompareAndSwap64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (OSAtomicCompareAndSwap64(expect_value, new_value, &DATA_PTR(self))) {
    ^
1 warning and 1 error generated.
make: *** [atomic_reference.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/devi/.rvm/gems/ruby-2.7.2/gems/atomic-1.1.14 for inspection.
Results logged to /Users/devi/.rvm/gems/ruby-2.7.2/extensions/arm64-darwin-20/2.7.0/atomic-1.1.14/gem_make.out

我已将 ruby 版本降级到 2.5.2 并尝试安装备份 gem,但我遇到了同样的问题。

这是因为版本不兼容,试试下面的命令

  sudo gem install backup -v5.0.0.beta.1