kgio, raindrops, unicorn and Ruby 2.2.0-preview1
I was trying to upgrade Codetriage to use Ruby 2.2.0-preview, the latest Ruby version. The project is hosted on Heroku. So to upgrade I changed Ruby version in Gemfile:
# Gemfile
ruby '2.2.0'
After that I tried to do bundle install:
bundle install
And boom. Got error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/prathamesh/.rbenv/versions/2.2.0-preview1/bin/ruby -r ./siteconf20141002-23644-1wbcnhc.rb extconf.rb
.....
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling accept.c
In file included from accept.c:90:
/Users/prathamesh/.rbenv/versions/2.2.0-preview1/include/ruby-2.2.0/ruby/backward/rubysig.h:14:2: warning: rubysig.h is obsolete [-W#warnings]
#warning rubysig.h is obsolete
^
accept.c:101:2: error: use of undeclared identifier 'TRAP_BEG'
TRAP_BEG;
^
accept.c:103:2: error: use of undeclared identifier 'TRAP_END'
TRAP_END;
^
1 warning and 2 errors generated.
make: *** [accept.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/prathamesh/.rbenv/versions/2.2.0-preview1/lib/ruby/gems/2.2.0/gems/kgio-2.8.0 for inspection.
Results logged to /Users/prathamesh/.rbenv/versions/2.2.0-preview1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-13/2.2.0-static/kgio-2.8.0/gem_make.out
An error occurred while installing kgio (2.8.0), and Bundler cannot continue.
Make sure that `gem install kgio -v '2.8.0'` succeeds before bundling.
kgio
gem is dependency of unicorn
which is the application server used by Codetriage. Looking at documentation of kgio, I found out that latest gem version is 2.9.2
while as our Gemfile.lock still had 2.8.0
.
The exact changelog entry is:
commit 6243d74cc8296d40a66969594e42963c896968ee
Author: Eric Wong <e@80x24.org>
Date: Sat Feb 15 09:21:07 2014 +0000
kgio 2.9.2 - avoid deprecated/removed function
This release is for compatibility with future releases of mainline ruby,
as rb_thread_blocking_region is removed in r44955 of ruby trunk
This also avoids deprecation warnings fo rb_thread_blocking_region
2.0 and 2.1.
So looks like this is the version that should be used with new versions of Ruby.
Solution
Replaced 2.8.0
with 2.9.2
for kgio gem in Gemfile.lock:
# Gemfile.lock
multi_json (>= 1.5)
kgio (2.9.2)
kramdown (1.3.2)
After updating Gemfile.lock and running bundle install
again, it completed successfully. I was able to run the app using Unicorn on Ruby 2.2.0-preview1.
See this PR to see more details.
Happy Hacking!
Update
After i submitted the PR, the tests could not be run on Travis because of error related to installing raindrops
gem which is also dependency of Unicorn:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/travis/.rvm/rubies/ruby-2.2.0-preview1/bin/ruby -r ./siteconf20141002-1677-1g08hg8.rb extconf.rb
....
linux_inet_diag.c:28:2: error: ‘TRAP_BEG’ undeclared (first use in this function)
linux_inet_diag.c:28:2: note: each undeclared identifier is reported only once for each function it appears in
linux_inet_diag.c:30:2: error: ‘TRAP_END’ undeclared (first use in this function)
linux_inet_diag.c: At top level:
linux_inet_diag.c:22:1: warning: ‘rb_thread_blocking_region’ defined but not used [-Wunused-function]
make: *** [linux_inet_diag.o] Error 1
I did not had this problem locally when I did bundle install. But to fix this, I again checked documentation for raindrops
. Turns out that the latest release of raindrops
is 0.13.0
whereas Gemfile.lock was still pointing to 0.11.0
. Also this release is specific to 2.2.0 according to changelog.
commit d24900b305a02cdedc4a532253798117f9686b5c
Author: Eric Wong <e@80x24.org>
Date: Tue Feb 18 20:57:46 2014 +0000
raindrops 0.13.0 several minor fixes and improvements
Most notably, this release is necessary for Ruby 2.2 (dev).
Thanks to Koichi Sasada for the bug report!
Eric Wong (5):
Rakefile: remove raa_update task
last_data_recv: do not assume Unicorn includes all constants
raindrops.gemspec: add wrongdoc dev dependency
linux_inet_diag: fix Ruby 2.2 (dev) build
license: use LGPLv2.1 or later (was LGPL (2.1|3.0)-only)
Hleb Valoshka (1):
Remove Scope IDs from IPv6 addresses.
Again applied same fix by changing Gemfile.lock and now raindrops is installedon Travis.