Rbenv + Ruby 2.2.0-dev にてあるものをインストールするとき、EventMachineでこけました。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/liubin/.rbenv/versions/2.2.0-dev/bin/ruby extconf.rb
/Users/liubin/.rbenv/versions/2.2.0-dev/lib/ruby/2.2.0/mkmf.rb:1523: warning: Insecure world writable dir /usr/local in PATH, mode 040777
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/liubin/.rbenv/versions/2.2.0-dev/include/ruby-2.2.0/ruby/intern.h:439: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/liubin/.rbenv/versions/2.2.0-dev/include/ruby-2.2.0/ruby/intern.h:439: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/liubin/.rbenv/versions/2.2.0-dev/include/ruby-2.2.0/ruby/intern.h:439: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/liubin/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.3 for inspection.
Results logged to /Users/liubin/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/eventmachine-1.0.3/gem_make.out
An error occurred while installing eventmachine (1.0.3), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.3'` succeeds before bundling.
なんかRubyのバージョンが違うのせいみたいです。
解決策はインストールもとをGitHubを指定することでした。
gem 'eventmachine', github: 'eventmachine/eventmachine', branch: :master