Ruby 1.9.3 + Rails 3.2.1 で segmentation fault -> 解決
Mac で Rails 3.2.1 を使おうとしたら、rails new するときにエラーになった。
% rails new myapp --skip-test-unit create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app ... create vendor/assets/javascripts/.gitkeep create vendor/assets/stylesheets create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle install /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] -- Control frame information ----------------------------------------------- c:0042 p:---- s:0226 b:0226 l:000225 d:000225 CFUNC :connect c:0041 p:0011 s:0223 b:0223 l:002620 d:000222 BLOCK /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799 c:0040 p:0031 s:0221 b:0221 l:000220 d:000220 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/timeout.rb:54 c:0039 p:0026 s:0209 b:0209 l:000208 d:000208 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/timeout.rb:99 c:0038 p:0485 s:0203 b:0203 l:002620 d:002620 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799 ... [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html
中略している部分も含めたすべてのエラーメッセージはココ。
解決したので、以下対応履歴のメモ
エラーメッセージでぐぐるといろいろヒットする。
- [ruby-trunk - Bug #5611][Open] Segfault in net/http.rb - Ruby Forum
- #4050: Have you had this Ruby 1.9.3 segmentation fault bug? - Issues - rails/rails - GitHub
- ruby-trunk - Bug #5655: Segfault in Net::HTTP on OS X Lion - Ruby Issue Tracking System
- Ruby 1.9.2 Segmentation Fault and OpenSSL
4の方法で macports でインストールした openssl を使うように指定して、 ruby 1.9.3 を再インストールしてみる。
% rvm list rvm rubies =* ruby-1.9.3-p0 [ x86_64 ] # => - current # =* - current && default # * - default % rvm remove 1.9.3-p0 Removing /Users/yz/.rvm/src/ruby-1.9.3-p0... Removing default ruby interpreter Removing /Users/yz/.rvm/rubies/ruby-1.9.3-p0... Removing default ruby interpreter Removing ruby-1.9.3-p0 aliases... Removing ruby-1.9.3-p0 wrappers... Removing ruby-1.9.3-p0 environments... Removing ruby-1.9.3-p0 binaries... % % rvm install 1.9.3 --with-openssl-dir=/opt/local Fetching yaml-0.1.4.tar.gz to /Users/yz/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/yz/.rvm/src Configuring yaml in /Users/yz/.rvm/src/yaml-0.1.4. Compiling yaml in /Users/yz/.rvm/src/yaml-0.1.4. Installing yaml to /Users/yz/.rvm/usr Installing Ruby from source to: /Users/yz/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/yz/.rvm/src/ruby-1.9.3-p0 ruby-1.9.3-p0 - #extracted to /Users/yz/.rvm/src/ruby-1.9.3-p0 ruby-1.9.3-p0 - #configuring ruby-1.9.3-p0 - #compiling ruby-1.9.3-p0 - #installing Removing old Rubygems files... Installing rubygems-1.8.15 for ruby-1.9.3-p0 ... Installation of rubygems completed successfully. ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p0 - #importing default gemsets (/Users/yz/.rvm/gemsets/) Install of ruby-1.9.3-p0 - #complete
再インストールした 1.9.3 を使うように変更
% rvm use 1.9.3 --default Using /Users/yz/.rvm/gems/ruby-1.9.3-p0
再度 Rails3.2.1をインストール
% rvm gemset create hogehoge % rvm gemset use hogehoge % gem install rails -v='3.2.1' --no-ri --no-rdoc Fetching: i18n-0.6.0.gem (100%) Fetching: multi_json-1.0.4.gem (100%) Fetching: activesupport-3.2.1.gem (100%) ... Fetching: json-1.6.5.gem (100%) Building native extensions. This could take a while... Fetching: rdoc-3.12.gem (100%) Depending on your version of ruby, you may need to install ruby rdoc/ri data: <= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay! Fetching: railties-3.2.1.gem (100%) Fetching: rails-3.2.1.gem (100%) Successfully installed i18n-0.6.0 Successfully installed multi_json-1.0.4 Successfully installed activesupport-3.2.1 ... Successfully installed rdoc-3.12 Successfully installed railties-3.2.1 Successfully installed rails-3.2.1 30 gems installed
rails new を実行
% rails new myapp create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app ... create vendor/assets/javascripts/.gitkeep create vendor/assets/stylesheets create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle install /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] -- Control frame information ----------------------------------------------- c:0042 p:---- s:0226 b:0226 l:000225 d:000225 CFUNC :connect c:0041 p:0011 s:0223 b:0223 l:001b00 d:000222 BLOCK /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799 c:0040 p:0031 s:0221 b:0221 l:000220 d:000220 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/timeout.rb:54 c:0039 p:0026 s:0209 b:0209 l:000208 d:000208 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/timeout.rb:99 c:0038 p:0485 s:0203 b:0203 l:001b00 d:001b00 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799 c:0037 p:0011 s:0195 b:0195 l:000194 d:000194 METHOD /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:755 ... 163 /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/openssl/x509-internal.rb 164 /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/openssl.rb 165 /Users/yz/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/https.rb [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html
ダメ
macports で入れた openssl ではダメっぽいので、4.のコメントにある方法でやり直し
% export PATH=/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.rvm/bin % rvm pkg install iconv Fetching libiconv-1.13.1.tar.gz to /Users/yz/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4605k 100 4605k 0 0 201k 0 0:00:22 0:00:22 --:--:-- 246k Extracting libiconv-1.13.1.tar.gz to /Users/yz/.rvm/src Configuring libiconv in /Users/yz/.rvm/src/libiconv-1.13.1. Compiling libiconv in /Users/yz/.rvm/src/libiconv-1.13.1. Installing libiconv to /Users/yz/.rvm/usr % rvm pkg install openssl Fetching openssl-0.9.8n.tar.gz to /Users/yz/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3681k 100 3681k 0 0 286k 0 0:00:12 0:00:12 --:--:-- 390k Extracting openssl-0.9.8n.tar.gz to /Users/yz/.rvm/src Configuring openssl in /Users/yz/.rvm/src/openssl-0.9.8n. Compiling openssl in /Users/yz/.rvm/src/openssl-0.9.8n. Installing openssl to /Users/yz/.rvm/usr % rvm install ruby-1.9.3 --with-openssl-dir=~$rvm_path/usr --with-iconv-dir=$rvm_path/usr Fetching yaml-0.1.4.tar.gz to /Users/yz/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/yz/.rvm/src Configuring yaml in /Users/yz/.rvm/src/yaml-0.1.4. Compiling yaml in /Users/yz/.rvm/src/yaml-0.1.4. Installing yaml to /Users/yz/.rvm/usr Installing Ruby from source to: /Users/yz/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #extracted to /Users/yz/.rvm/src/ruby-1.9.3-p0 (already extracted) ruby-1.9.3-p0 - #configuring ruby-1.9.3-p0 - #compiling ruby-1.9.3-p0 - #installing Removing old Rubygems files... Installing rubygems-1.8.15 for ruby-1.9.3-p0 ... Installation of rubygems completed successfully. ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p0 - #importing default gemsets (/Users/yz/.rvm/gemsets/) Install of ruby-1.9.3-p0 - #complete % rvm use 1.9.3 --default* rvm で gemset 作成
% rvm gemset create rails3_test 'rails3_test' gemset created (/Users/yz/.rvm/gems/ruby-1.9.3-p0@rails3_test). % rvm gemset use rails3_test % rvm list rvm rubies ruby-1.9.2-p290 [ x86_64 ] * ruby-1.9.3-p0 [ x86_64 ] # => - current # =* - current && default # * - default % rvm gemset list gemsets for ruby-1.9.3-p0 (found in /Users/yz/.rvm/gems/ruby-1.9.3-p0) gemset global => rails3_test
rails 3.1.2 をインストール
% gem install rails -v='3.2.1' Fetching: i18n-0.6.0.gem (100%) Fetching: multi_json-1.0.4.gem (100%) Fetching: activesupport-3.2.1.gem (100%) Fetching: builder-3.0.0.gem (100%) ... Installing RDoc documentation for rdoc-3.12... Installing RDoc documentation for railties-3.2.1... Installing RDoc documentation for rails-3.2.1...
rails new してみる
% rails new myapp create create README.rdoc create Rakefile create config.ru create .gitignore create Gemfile create app create app/assets/images/rails.png ... create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle install Fetching source index for https://rubygems.org/ Using rake (0.9.2.2) Using i18n (0.6.0) Using multi_json (1.0.4) Using activesupport (3.2.1) ... Installing sass-rails (3.2.4) Installing sqlite3 (1.3.5) with native extensions Installing uglifier (1.2.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
できた。
コメント