Skip to main content
2 / 2
本文に 2463 文字追加
xjr399
  • 340
  • 3
  • 26

bundle installするとgem install linecache19に失敗する

あるrailsアプリケーションのruby,RonRのバージョンアップをしようとしています。
まずrubyのバージョンをアップ(ruby 1.9.2p320⇒2.2.3)したところbundle installで失敗するようになり以下のようなエラーを出すようになりました。

[devel@CS-c014 3.3.x_version_up]$ rbenv exec bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.1.1
 :
 :
Installing linecache19 0.5.12 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/devel/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151008-8095-rmksgw.rb extconf.rb
checking for vm_core.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/devel/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
        --with-ruby-dir
        --without-ruby-dir
        --with-ruby-include
        --without-ruby-include=${ruby-dir}/include
        --with-ruby-lib
        --without-ruby-lib=${ruby-dir}/lib
/home/devel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39:in `create_makefile_with_core': uninitialized constant Ruby_core_source::Config (NameError)
        from extconf.rb:19:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/devel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/linecache19-0.5.12 for inspection.
Results logged to /home/devel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/linecache19-0.5.12/gem_make.out
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.

gem 'ruby-debug19'を使用しているのですがrubyバージョンあげると使えなくなるということでしょうか?エラーを解消する方法もしくは代替のgemがありましたら教えて頂けますでしょうか?

byebugを入れて上記問題は解決しました。その後再度bundle installしたところ次はmysql2でエラーになりました。Gemfile.lockで0.3.11を指定しているのですがこれを消すようにすればいいのでしょうか?それともbundle updateを使うようにした方がいいのでしょうか?

[devel@CS-c014 3.3.x_version_up]$ rbenv exec bundle install
Fetching gem metadata from https://rubygems.org/..........
 :
 :
Installing mysql2 0.3.11 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/devel/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151009-7748-hhyv3.rb extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling result.c
./client.h:11 から include されたファイル中,
                 ./mysql2_ext.h:39 から,
                 result.c:1 から:
/home/devel/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/backward/rubysig.h:14:2: 警告: #warning rubysig.h is obsolete
In file included from ./mysql2_ext.h:39,
                 from result.c:1:
./client.h:13: error: redefinition of typedef ‘rb_unblock_function_t’
/home/devel/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:897: note: previous declaration of ‘rb_unblock_function_t’ was here
./client.h:14: error: redefinition of typedef ‘rb_blocking_function_t’
/home/devel/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:898: note: previous declaration of ‘rb_blocking_function_t’ was here
./client.h: In function ‘rb_thread_blocking_region’:
./client.h:23: error: ‘TRAP_BEG’ undeclared (first use in this function)
./client.h:23: error: (Each undeclared identifier is reported only once
./client.h:23: error: for each function it appears in.)
./client.h:25: error: ‘TRAP_END’ undeclared (first use in this function)
make: *** [result.o] エラー 1

make failed, exit code 2

Gem files will remain installed in /home/devel/.rbenv/versions/2.2.3/gemsets/3.3.x_version_up/gems/mysql2-0.3.11 for inspection.
Results logged to /home/devel/.rbenv/versions/2.2.3/gemsets/3.3.x_version_up/extensions/x86_64-linux/2.2.0-static/mysql2-0.3.11/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
xjr399
  • 340
  • 3
  • 26