Ruby 1.9.1, Test/Unit, and EventMachine

I'm trying to install my second gem after updating to Ruby 1.9.1, and
I'm having problems.

First of all, I found that I couldn't install EventMachine as it was,
because it depended on Test/Unit which is apparently not bundled with
Ruby as of 1.9; so I ran `sudo gem install test-unit`. Everything
appeared to go smoothly.

However, having cloned EventMachine from GitHub and built the gem, I
get this error when trying to `gem install` the .gem file:

···

--------------------------------
〈Sun Feb 01 - 09:39:54〉〈elliottcable - Geoffrey〉〈~/Code/src/
eventmachine/〉〈master - ae1f407〉
➜ gem install pkg/eventmachine-0.12.3.gem
WARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.9.1
and
    /usr/local/bin aren't both writable.
WARNING: You don't have /Users/elliottcable/.gem/ruby/1.9.1/bin in
your PATH,
    gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing pkg/eventmachine-0.12.3.gem:
  ERROR: Failed to build gem native extension.

rake RUBYARCHDIR=/Users/elliottcable/.gem/ruby/1.9.1/gems/
eventmachine-0.12.3/lib RUBYLIBDIR=/Users/elliottcable/.gem/ruby/1.9.1/
gems/eventmachine-0.12.3/lib
cd ext
(in /Users/elliottcable/.gem/ruby/1.9.1/gems/eventmachine-0.12.3)
checking for rb_thread_blocking_region()... yes
checking for RB_UBF_DFL in ruby.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
creating Makefile
cd -
cd ext
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o binder.o -c
binder.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o cmain.o -c
cmain.cpp
cmain.cpp:501:2: warning: "/*" within comment
cmain.cpp: In function ‘int evma_send_file_data_to_connection(const
char*, const char*)’:
cmain.cpp:527: warning: comparison between signed and unsigned integer
expressions
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o cplusplus.o
-c cplusplus.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o ed.o -c
ed.cpp
ed.cpp: In constructor ‘DatagramDescriptor::DatagramDescriptor(int,
EventMachine_t*)’:
ed.cpp:1058: warning: unused variable ‘sob’
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o em.o -c
em.cpp
em.h: In constructor ‘EventMachine_t::EventMachine_t(void (*)(const
char*, int, const char*, int))’:
em.h:144: warning: ‘EventMachine_t::bKqueue’ will be initialized after
em.h:142: warning: ‘int EventMachine_t::epfd’
em.cpp:73: warning: when initialized here
em.cpp: In static member function ‘static int
EventMachine_t::SetRlimitNofile(int)’:
em.cpp:252: warning: comparison between signed and unsigned integer
expressions
em.cpp: In member function ‘bool EventMachine_t::_RunKqueueOnce()’:
em.cpp:580: warning: comparison between signed and unsigned integer
expressions
em.cpp: In member function ‘const char*
EventMachine_t::InstallOneshotTimer(int)’:
em.cpp:881: warning: comparison between signed and unsigned integer
expressions
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o emwin.o -c
emwin.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o epoll.o -c
epoll.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o files.o -c
files.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o kb.o -c
kb.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o page.o -c
page.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o pipe.o -c
pipe.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o rubymain.o -
c rubymain.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o sigs.o -c
sigs.cpp
g++ -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.6.0 -I/usr/local/
include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -
DBUILD_FOR_RUBY -DHAVE_RB_THREAD_BLOCKING_REGION -DOS_UNIX -
DHAVE_SYS_EVENT_H -DHAVE_SYS_QUEUE_H -DHAVE_KQUEUE -DWITH_SSL -
D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -g -Wall -Wno-
parentheses -pipe -fno-common -I/opt/local/include -o ssl.o -c
ssl.cpp
g++ -dynamic -bundle -undefined suppress -flat_namespace -o
rubyeventmachine.bundle binder.o cmain.o cplusplus.o ed.o em.o emwin.o
epoll.o files.o kb.o page.o pipe.o rubymain.o sigs.o ssl.o -L. -L/usr/
local/lib -L. -L/usr/local/lib -L/opt/local/lib -lssl -lcrypto -
lz -lpthread -ldl -lobjc
cd -
mv ext/rubyeventmachine.bundle lib
Loaded suite tests/testem
Started
........................................................................../
usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/unit/ui/
console/testrunner.rb:141:in `flush': Bad file descriptor
(Errno::EBADF)
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:141:in `output_single'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:129:in `output'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:124:in `nl'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:93:in `finished'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/util/observable.rb:78:in `call'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/util/observable.rb:78:in `block in notify_listeners'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/util/observable.rb:78:in `each'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/util/observable.rb:78:in `notify_listeners'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/testrunnermediator.rb:55:in `ensure in run_suite'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/testrunnermediator.rb:55:in `run_suite'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:74:in `start_mediator'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/console/testrunner.rb:46:in `start'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/ui/testrunnerutilities.rb:24:in `run'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/autorunner.rb:269:in `run'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit/autorunner.rb:44:in `run'
  from /usr/local/lib/ruby/gems/1.9.1/gems/test-unit-2.0.2/lib/test/
unit.rb:340:in `block in <top (required)>'
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -Ilib -Iext -
Ijava tes...]

(See full trace by running task with --trace)

Gem files will remain installed in /Users/elliottcable/.gem/ruby/1.9.1/
gems/eventmachine-0.12.3 for inspection.
Results logged to /Users/elliottcable/.gem/ruby/1.9.1/gems/
eventmachine-0.12.3/gem_make.out
Updating class cache with 1318 classes...
--------------------------------

I wouldn't post this on this list, except that I'm not sure if the
problem originates in EventMachine or Test/Unit or in changes
introduced in 1.9.1. Any help is appreciated!

elliottcable wrote:

I'm trying to install my second gem after updating to Ruby 1.9.1, and
I'm having problems.

Reports of Ruby 1.8's death were greatly exaggerated. Go back!

···

--
   Ruby 1.8