Ruby on rails Can';t构建eventmachine 1.0.3 Mac OS X 10.9.2

Ruby on rails Can';t构建eventmachine 1.0.3 Mac OS X 10.9.2,ruby-on-rails,ruby-on-rails-4,gem,Ruby On Rails,Ruby On Rails 4,Gem,我想重新安装RubyonRails环境,但失败了 我使用Mac OS X10.9.2,使用Ruby 2.1.2,Apple LLVM版本5.1(clang-503.0.40) 我想跑: gem install eventmachine -v '1.0.3' 但我得到: Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed t

我想重新安装RubyonRails环境,但失败了

我使用Mac OS X10.9.2,使用Ruby 2.1.2,Apple LLVM版本5.1(clang-503.0.40

我想跑:

gem install eventmachine -v '1.0.3'
但我得到:

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

    /Users/nm/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
compiling cmain.cpp
compiling ed.cpp
ed.cpp:987:18: warning: variable length arrays are a C99 feature [-Wvla-extension]
        struct iovec iov[ iovcnt ];
                        ^
1 warning generated.
compiling em.cpp
em.cpp:75:2: warning: field 'LoopBreakerWriter' will be initialized after field 'NumCloseScheduled' [-Wreorder]
        LoopBreakerWriter (-1),
        ^
em.cpp:822:2: warning: 'rb_thread_blocking_region' is deprecated [-Wdeprecated-declarations]
        rb_thread_blocking_region (_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0);
        ^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/intern.h:870:18: note: 'rb_thread_blocking_region' declared here
DEPRECATED(VALUE rb_thread_blocking_region(rb_blocking_function_t *func, void *data1,
                 ^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0/ruby/config.h:114:52: note: expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
em.cpp:946:6: warning: 'rb_thread_select' is deprecated [-Wdeprecated-declarations]
                                        EmSelect (0, NULL, NULL, NULL, &tv);
                                        ^
./em.h:25:20: note: expanded from macro 'EmSelect'
  #define EmSelect rb_thread_select
                   ^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/intern.h:440:16: note: 'rb_thread_select' declared here
DEPRECATED(int rb_thread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *));
               ^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0/ruby/config.h:114:52: note: expanded from macro 'DEPRECATED'
#define DEPRECATED(x) __attribute__ ((deprecated)) x
                                                   ^
em.cpp:1109:40: error: invalid operands to binary expression ('__bind<int &, sockaddr *&, int &>' and 'int')
                if (bind (sd, bind_to, bind_to_size) < 0) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
em.cpp:1522:6: error: value of type '__bind<int &, sockaddr *&, int &>' is not contextually convertible to 'bool'
        if (bind (sd_accept, bind_here, bind_size)) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
em.cpp:1600:53: error: invalid operands to binary expression ('__bind<int &, sockaddr *, unsigned long>' and 'int')
        if (bind (sd, (struct sockaddr*)&sin, sizeof(sin)) != 0)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
em.cpp:1869:6: error: value of type '__bind<int &, sockaddr *, unsigned long>' is not contextually convertible to 'bool'
        if (bind (sd_accept, (struct sockaddr*)&s_sun, sizeof(s_sun))) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from em.cpp:23:
In file included from ./project.h:150:
./em.h:189:12: warning: private field 'NextHeartbeatTime' is not used [-Wunused-private-field]
                uint64_t NextHeartbeatTime;
                         ^
./em.h:221:22: warning: private field 'inotify' is not used [-Wunused-private-field]
                InotifyDescriptor *inotify; // pollable descriptor for our inotify instance
                                   ^
5 warnings and 4 errors generated.
make: *** [em.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/nm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3 for inspection.
Results logged to /Users/nm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/eventmachine-1.0.3/gem_make.out
构建本机扩展。这可能需要一段时间。。。
错误:安装eventmachine时出错:
错误:无法生成gem本机扩展。
/Users/nm/.rbenv/versions/2.1.2/bin/ruby extconf.rb
正在检查ruby.h、rubysig.h中的rb_陷阱_立即数。。。不
正在检查rb\u线程\u阻塞\u区域()。。。对
正在检查sys/inotify.h中的inotify_init()。。。不
正在检查sys/syscall.h中的\uu NR\u inotify\u init。。。不
正在检查sys/uio.h中的writev()。。。对
正在检查rb_wait_for_single_fd()。。。对
正在检查rb_启用_中断()。。。不
正在检查rb_time_new()。。。对
正在检查sys/event.h。。。对
正在检查sys/queue.h。。。对
创建Makefile
使“DESTDIR=”干净
使“DESTDIR=”
编译binder.cpp
编译cmain.cpp
编译ed.cpp
ed.cpp:987:18:警告:可变长度数组是C99功能[-Wvla扩展]
结构iovec iov[iovcnt];
^
生成1个警告。
编译em.cpp
em.cpp:75:2:警告:字段“LoopBreakerWriter”将在字段“NumCloseScheduled”[-Wreorder]之后初始化
环路中断器(-1),
^
em.cpp:822:2:警告:“rb\u线程\u阻塞\u区域”已弃用[-Wdeprecated声明]
rb_线程_阻塞_区域(_SelectDataSelect,(void*)this,RUBY_UBF_IO,0);
^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/intern.h:870:18:注意:此处声明了“rb\u线程\u阻塞\u区域”
已弃用(值rb_线程_阻塞_区域(rb_阻塞_函数_t*func,void*data1,
^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0/ruby/config.h:114:52:注意:从宏“已弃用”展开
#定义不推荐的(x)_属性_((不推荐))x
^
em.cpp:946:6:警告:“rb\u thread\u select”已弃用[-Wdeprecated声明]
EmSelect(0、NULL、NULL、NULL和tv);
^
/em.h:25:20:注意:从宏“EmSelect”展开
#定义EmSelect rb\U thread\U select
^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/intern.h:440:16:注意:此处声明了“rb\u线程\u选择”
已弃用(int-rb_-thread_-select(int、fd_-set*、fd_-set*、fd_-set*、struct-timeval*);
^
/Users/nm/.rbenv/versions/2.1.2/include/ruby-2.1.0/x86_64-darwin13.0/ruby/config.h:114:52:注意:从宏“已弃用”展开
#定义不推荐的(x)_属性_((不推荐))x
^
em.cpp:1109:40:错误:二进制表达式(“绑定”和“int”)的操作数无效
if(绑定(sd,绑定到,绑定到大小)<0){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
em.cpp:1522:6:错误:类型“\uu bind”的值不能在上下文中转换为“bool”
if(绑定(sd_接受、绑定这里、绑定大小)){
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
em.cpp:1600:53:错误:二进制表达式(“绑定”和“int”)的操作数无效
if(bind(sd,(struct sockaddr*)&sin,sizeof(sin))!=0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
em.cpp:1869:6:错误:类型“\uu bind”的值不能在上下文中转换为“bool”
if(绑定(sd_accept,(struct sockaddr*)&s_sun,sizeof(s_sun))){
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在em.cpp中包含的文件中:23:
在包含于./project.h:150的文件中:
./em.h:189:12:警告:未使用专用字段“nextheartbeatime”[-wUsed private field]
uint64\t下一次播放时间;
^
/em.h:221:22:警告:未使用专用字段“inotify”[-Wunused private field]
InotifyDescriptor*inotify;//inotify实例的可轮询描述符
^
生成5个警告和4个错误。
make:**[em.o]错误1
make失败,退出代码2
Gem文件仍将安装在/Users/nm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3中以供检查。
结果记录到/Users/nm/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/eventmachine-1.0.3/gem_make.out
当我安装版本1.0.1或1.0.2时,我会遇到一些类似的错误


有人能告诉我原因吗?谢谢。

从文档中看,eventmachine似乎还不支持Ruby 2+

EventMachine支持Ruby 1.8.7、1.9.2、REE和JRuby,并且在 Windows以及Unix系列的许多操作系统(Linux、, MacOSX,BSD风格)


Gem thin取决于它。我会在Ruby 2上安装thin(这样eventmachine会自动安装)。