安装时的Eventmachine问题(安装Middleman时)

时间:2015-01-15 11:18:38

标签: ruby eventmachine

它不是Eventmachine gem install fail的重复版本,适用于Windows,而且我在OSX 10.9.5和ruby ruby​​ 2.2.0p0上运行

在安装了Middleman后,我很难安装Eventmachine。关于如何进行的任何建议? 我已经尝试过sudo gem install eventmachine -v' 1.0.3'和gem安装eventmachine -v 1.0.4但没有运气。

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

      /Users/malditojavi/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20150115-4062-w3t883.rb extconf.rb
  checking for rb_trap_immediate in ruby.h,rubysig.h... no
  checking for rb_thread_blocking_region()... no
  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
  compiling em.cpp
  em.cpp:827:9: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
          return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
                 ^~~~~~~~
                 rb_thread_fd_select
  ./em.h:25:20: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
  /Users/malditojavi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
  int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
      ^
  em.cpp:827:32: error: cannot initialize a parameter of type 'rb_fdset_t *' with an rvalue of type 'fd_set *'
          return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv);
                                        ^~~~~~~~
  /Users/malditojavi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:454:42: note: passing argument to parameter here
  int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
                                           ^
  em.cpp:946:6: error: use of undeclared identifier 'rb_thread_select'; did you mean 'rb_thread_fd_select'?
                                          EmSelect (0, NULL, NULL, NULL, &tv);
                                          ^~~~~~~~
                                          rb_thread_fd_select
  ./em.h:25:20: note: expanded from macro 'EmSelect'
    #define EmSelect rb_thread_select
                     ^
  /Users/malditojavi/.rvm/rubies/ruby-2.2.0/include/ruby-2.2.0/ruby/intern.h:454:5: note: 'rb_thread_fd_select' declared here
  int rb_thread_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
      ^
  3 errors generated.
  make: *** [em.o] Error 1

  make failed, exit code 2

  Gem files will remain installed in /Users/malditojavi/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.3 for inspection.
  Results logged to /Users/malditojavi/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0/eventmachine-1.0.3/gem_make.out

3 个答案:

答案 0 :(得分:2)

Eventmachine 1.0.3和Ruby 2.2.x之间存在不兼容性。要修复它,要么

  • 将Ruby降级为2.1.2(在Gemfile顶部添加ruby '2.1.2'

  • 将您的Eventmachine gem升级到1.0.4

答案 1 :(得分:1)

您应该使用以下方法升级捆绑包中的eventmachine版本:

bundle update eventmachine

答案 2 :(得分:0)

git repo上有一个帖子说明这个命令应该有效:

 bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include

原始问题:https://github.com/middleman/middleman/issues/1699#issuecomment-162623491