无法在新的Mac M3上捆绑安装nio4r

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

我刚刚购买了一台运行 Sonoma 的新 M3,但运行时遇到以下错误

bundle

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

我尝试了错误消息中的建议,但没有成功,并且一直在互联网上寻找解决方案,并尝试了〜10种不同的方法,但没有任何方法可以让我解决这个问题。我安装了 XCode,并尝试了各种

bundle config
标志。不知道还能尝试什么。

这个原生 gem 是

puma
(如果需要,我可以用
unicorn
替换)和
actioncable
(似乎与
rails
gem 一起提供的,不过如果有某种方法可以安装
rails
需要)它,我很高兴这样做)。

从相关部分开始的完整回溯是:

...
Installing nio4r 2.5.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/nio4r-2.5.8/ext/nio4r
/Users/aaronecohen/.asdf/installs/ruby/3.0.2/bin/ruby -I /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/3.0.0 -r ./siteconf20240411-97157-bvwsjv.rb extconf.rb
--with-cflags\=-std\=c99
checking for unistd.h... yes
checking for linux/aio_abi.h... no
checking for linux/io_uring.h... no
checking for sys/select.h... yes
checking for port_event_t in poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port_event_t in port.h... no
checking for sys/resource.h... yes
creating Makefile

current directory: /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/nio4r-2.5.8/ext/nio4r
make DESTDIR\= clean

current directory: /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/nio4r-2.5.8/ext/nio4r
make DESTDIR\=
compiling bytebuffer.c
compiling monitor.c
compiling nio4r_ext.c
In file included from nio4r_ext.c:6:
./../libev/ev.c:573:48: warning: '/*' within block comment [-Wcomment]
/*#define MIN_INTERVAL  0.00000095367431640625 /* 1/2**20, good till 2200 */
                                               ^
./../libev/ev.c:2136:31: warning: 'extern' variable has an initializer [-Wextern-initializer]
  EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */
                              ^
2 warnings generated.
compiling selector.c
selector.c:301:26: error: incompatible function pointer types passing 'VALUE (*)(VALUE *)' (aka 'unsigned long (*)(unsigned long *)') to parameter of type 'VALUE (*)(VALUE)' (aka
'unsigned long (*)(unsigned long)') [-Wincompatible-function-pointer-types]
        return rb_ensure(func, (VALUE)args, NIO_Selector_unlock, self);
                         ^~~~
/Users/aaronecohen/.asdf/installs/ruby/3.0.2/include/ruby-3.0.0/ruby/internal/iterator.h:53:24: note: passing argument to parameter here
VALUE rb_ensure(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE),VALUE);
                       ^
1 error generated.
make: *** [selector.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/nio4r-2.5.8 for inspection.
Results logged to /Users/aaronecohen/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/extensions/arm64-darwin-23/3.0.0/nio4r-2.5.8/gem_make.out

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

In Gemfile:
  rails was resolved to 7.0.4.3, which depends on
    actioncable was resolved to 7.0.4.3, which depends on
      nio4r

非常感谢您的建议,即使它们最终不能解决问题。

ruby-on-rails rubygems bundle
1个回答
0
投票

解决方案是根据其他可用的存储库升级到 Ruby 3.1。

© www.soinside.com 2019 - 2024. All rights reserved.