当我在rails 5项目上运行bundle install
时,我在gems上遇到了一些错误,这些错误似乎是本机扩展的.以下是其中一个Ruby 的输出顶部:
Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
checking for unistd.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl()... yes
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile
current directory: /Users/<my-username>/.rvm/gems/ruby-2.7.4/gems/nio4r-1.2.1/ext/nio4r
make "DESTDIR=" clean
current directory: /Users/<my-username>/.rvm/gems/ruby-2.7.4/gems/nio4r-1.2.1/ext/nio4r
make "DESTDIR="
compiling monitor.c
monitor.c:91:24: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
if(interests_id == rb_intern("r")) {
^~~~~~~~~~~~~~
/Users/<my-username>/.rvm/rubies/ruby-2.7.4/include/ruby-2.7.0/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
monitor.c:91:24: note: '{' token is here
if(interests_id == rb_intern("r")) {
^~~~~~~~~~~~~~
我试过很多方法.
每this post人中,我try 了以下建议:
# didn't fix it
bundle config build.nio4r --with-cflags="-std=c99"
bundle
# didn't fix it
xcode-select --install
sudo xcodebuild -license accept
bundle
我还提到了this Go Rails guide,特别是"最终步骤"部分,该部分处理需要C扩展的GEM,但该命令似乎不适用,因为我没有从Mojave迁移macOS.
现在我不确定下一步该怎么做.最终:问题似乎是无法安装需要C扩展的gems.
环境:
- macOS Monterey
12.2
版 - 在ruby version
2.7.4
中使用rvm - 该项目使用的是rails版本
5.0.1