[RubyOnRails4] therubyracer error: ‘class v8::HeapStatistics’ has no member named ‘total_physical_size’


環境
CentOS 6.3
ruby 2.1
rails 4

「therubyracer -v ‘0.12.2’」をinstallしようとしたら「error: ‘class v8::HeapStatistics’ has no member named ‘total_physical_size’」というエラーが出てしまった。

# gem install therubyracer -v ‘0.12.2’

                                                                                                                                                             
Fetching: therubyracer-0.12.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for main() in -lpthread... yes
checking for v8.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling object.cc
compiling array.cc
compiling invocation.cc
compiling template.cc
compiling external.cc
compiling constants.cc
compiling string.cc
compiling signature.cc
compiling v8.cc
compiling date.cc
compiling message.cc
compiling rr.cc
compiling accessor.cc
compiling heap.cc
heap.cc: In static member function ‘static VALUE rr::HeapStatistics::total_physical_size(VALUE)’:
heap.cc:24: error: ‘class v8::HeapStatistics’ has no member named ‘total_physical_size’
make: *** [heap.o] エラー 1

make failed, exit code 2

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.1@portal/gems/therubyracer-0.12.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.1@portal/extensions/x86-linux/2.1.0/therubyracer-0.12.0/gem_make.out

「’class v8::HeapStatistics’ has no member named ‘total_physical_size’」ってなってるので、v8が入ってないのかと思いyumで入れようとしてみた。

# yum install v8

Setting up Install Process
Package 1:v8-3.14.5.10-11.el6.i686 already installed and latest version
Nothing to do

既にinstallされていた。関係無かったようだ。

んじゃ何かというとlibv8が原因だったようだ。
確認したら2つのバージョンがインストールされていたのでuninstallしてみた。

# gem uninstall libv8

Select gem to uninstall:
 1. libv8-3.11.8.3
 2. libv8-3.16.14.7
 3. All versions
> 3
Successfully uninstalled libv8-3.11.8.3
Successfully uninstalled libv8-3.16.14.7

この状態でtherubyracerをいれたところinnstallできた。

# gem install therubyracer -v ‘0.12.2’

Fetching: libv8-3.16.14.8.rc1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed libv8-3.16.14.8.rc1
Building native extensions.  This could take a while...
Successfully installed therubyracer-0.12.2
Parsing documentation for libv8-3.16.14.8.rc1
Installing ri documentation for libv8-3.16.14.8.rc1
Parsing documentation for therubyracer-0.12.2
Installing ri documentation for therubyracer-0.12.2
Done installing documentation for libv8, therubyracer after 0 seconds
2 gems installed

ついでにlibv8もinstallされたので「therubyracer」と「libv8」のバージョンを揃えないといけないみたいですね。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です