by-2.2.0/ruby/backward/rubysig.h:14:2: warning: #w
博客专区 > netmouse 的博客 > 博客详情
by-2.2.0/ruby/backward/rubysig.h:14:2: warning: #w
netmouse 发表于3年前
by-2.2.0/ruby/backward/rubysig.h:14:2: warning: #w
  • 发表于 3年前
  • 阅读 252
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】新注册用户域名抢购1元起>>>   

摘要: ruby-2.2.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obso

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 Rubyversion 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 installed on Travis.

After effects of updating openssl on Mac OS X

26 Sep 2014

Today, my openssl library on Mac OS X Mavericks got updated. After the update, when i tried doing rails s on one of the rails apps, it gave following error:

/Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta1/lib/rails/app_rails_loader.rb:39: warning: Insecure world writable dir /usr in PATH, mode 040777 /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.2/lib/bundler.rb:302: warning: Insecure world writable dir /usr in PATH, mode 040777 /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/openssl.rb:17:in `require': dlopen(/Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method (LoadError)   Referenced from: /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle   Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib  in /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle - /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle     from     /Users/prathamesh/.rbenv/versions/2.1.2/lib/ruby/2.1.0/openssl.rb:17:in     `<top (required)>' 

Seems like the link between openssl and Ruby is broken after the update. Fortunately the fix is very simple. Re-install Ruby again. It will re-link the updated openssl and this problem will be gone.

$ rbenv install 2.1.2      [2.1.2] rbenv: /Users/prathamesh/.rbenv/versions/2.1.2 already exists continue with installation? (y/N) y Downloading ruby-2.1.2.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/a5b5c83565f8bd954ee522bd287d2ca1 Installing ruby-2.1.2... 

After installing the Ruby again, rails s started without any complains.

Hope this saves some time to somebody! Happy Hacking :)

Talk at RubyKaigi

25 Sep 2014

Recently, I gave a talk at RubyKaigi 2014. It was pretty awesome to talk at RubyKaigi. Here are my slides for the talk.

And here is the video.

  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 4
博文 84
码字总数 32193
×
netmouse
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: