LoginSignup
17
13

More than 5 years have passed since last update.

therubyracerのbundle installが通らない

Last updated at Posted at 2016-04-22

初めに

  • carrierwaveでS3を使用するために、gemのfogを入れようとした
  • するとlibv8、v8、therubyracer周りでエラーが発生した
  • 色々いじったところ、最終的にtherubyracerのbundle installが通らず、時間がかかった

下記のやり方をしたところ、解決できたので共有します。

エラーログ

下記のエラーログが発生していました。

$ bundle install --path vendor/bundle
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.4.2
Using CFPropertyList 2.3.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types 2.99
Using sass 3.4.20
Using thor 0.19.1
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using formtastic_i18n 0.6.0
Using arel 6.0.3
Using bundler 1.11.2
Using concurrent-ruby 1.0.0
Using tilt 2.0.1
Using addressable 2.4.0
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using byebug 8.2.1
Using ffi 1.9.10
Using choice 0.2.0
Using chronic 0.10.2
Using coderay 1.1.1
Using daemons 1.2.3
Using database_cleaner 1.0.1
Using orm_adapter 0.5.0
Using diff-lcs 1.2.5
Using excon 0.49.0
Using multipart-post 2.0.0
Using formatador 0.2.5
Using multi_json 1.11.2
Using ipaddress 0.8.3
Using xml-simple 1.1.5
Using inflecto 0.0.2
Using trollop 2.1.2
Using geocoder 1.3.0
Using git-version-bump 0.15.1
Using gmaps4rails 2.1.2
Using google-analytics-rails 1.1.0
Using hashie 3.4.3
Using jwt 1.5.2
Using libv8 3.16.14.13
Using method_source 0.8.2
Using multi_xml 0.5.5
Using oauth 0.4.7
Using pg 0.18.4
Using slop 3.6.0
Using ruby-graphviz 1.2.2
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.4
Using ref 2.0.0
Using rmagick 2.15.4
Using rspec-core 2.14.8
Using rspec-mocks 2.14.6
Using rubyzip 1.1.7
Using websocket 1.2.2
Using spring 1.6.1
Using sqlite3 1.3.11
Using fission 0.5.0
Using faker 1.1.2
Using rdoc 4.2.1
Using tzinfo 1.2.2
Using nokogiri 1.6.7.1
Using rack-test 0.6.3
Using warden 1.2.4
Using mail 2.6.3
Using bourbon 4.2.6
Using coffee-script 2.4.1
Using uglifier 2.7.2
Using sprockets 3.5.2
Using launchy 2.3.0
Using binding_of_caller 0.7.2
Using childprocess 0.5.9
Using whenever 0.9.4
Using rspec-expectations 2.14.5
Using faraday 0.9.2
Using fog-core 1.38.0
Using rack-contrib 1.4.0
Using omniauth 1.3.1
Using pry 0.10.3
Using rails_12factor 0.0.3
Installing therubyracer 0.12.2 with native extensions

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

    /Users/名前/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20160422-18351-15ujdwo.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... yes
checking for main() in -lv8... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling accessor.cc
clang: warning: argument unused during compilation: '-rdynamic'
In file included from accessor.cc:1:
In file included from ./rr.h:4:
/usr/local/include/v8.h:355:33: error: use of undeclared identifier 'nullptr'
  V8_INLINE MaybeLocal() : val_(nullptr) {}
                                ^
/usr/local/include/v8.h:362:51: error: use of undeclared identifier 'nullptr'
  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
                                                  ^
/usr/local/include/v8.h:366:29: error: use of undeclared identifier 'nullptr'
    out->val_ = IsEmpty() ? nullptr : this->val_;
                            ^
/usr/local/include/v8.h:432:50: error: use of undeclared identifier 'nullptr'
  bool IsFirstPass() const { return callback_ != nullptr; }
                                                 ^
/usr/local/include/v8.h:803:42: error: use of undeclared identifier 'nullptr'
  V8_INLINE Global() : PersistentBase<T>(nullptr) {}
                                         ^
/usr/local/include/v8.h:828:18: error: use of undeclared identifier 'nullptr'
    other.val_ = nullptr;
                 ^
/usr/local/include/v8.h:840:18: error: use of undeclared identifier 'nullptr'
      rhs.val_ = nullptr;
                 ^
/usr/local/include/v8.h:1105:52: error: use of undeclared identifier 'nullptr'
                            ScriptOrigin* origin = nullptr));
                                                   ^
/usr/local/include/v8.h:1108:30: error: use of undeclared identifier 'nullptr'
      ScriptOrigin* origin = nullptr);
                             ^
/usr/local/include/v8.h:3250:36: error: use of undeclared identifier 'nullptr'
    return NewInstance(context, 0, nullptr);
                                   ^
/usr/local/include/v8.h:7262:27: error: use of undeclared identifier 'nullptr'
  if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
                          ^
In file included from accessor.cc:1:
./rr.h:358:39: error: no member named 'ScriptData' in namespace 'v8'
class ScriptData : public Pointer<v8::ScriptData> {
                                  ~~~~^
./rr.h:358:51: error: expected class name
class ScriptData : public Pointer<v8::ScriptData> {
                                                  ^
./rr.h:360:21: error: no type named 'ScriptData' in namespace 'v8'; did you mean simply 'ScriptData'?
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                    ^~~~~~~~~~~~~~
                    ScriptData
./rr.h:358:7: note: 'ScriptData' declared here
class ScriptData : public Pointer<v8::ScriptData> {
      ^
./rr.h:360:54: error: no member named 'ScriptData' in namespace 'v8'
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                                                 ~~~~^
./rr.h:360:65: error: expected class member or base class name
  inline ScriptData(v8::ScriptData* d) : Pointer<v8::ScriptData>(d) {};
                                                                ^
./rr.h:360:65: error: expected '{' or ','
./rr.h:361:48: error: no member named 'ScriptData' in namespace 'v8'
  inline ScriptData(VALUE value) : Pointer<v8::ScriptData>(value) {}
                                           ~~~~^
./rr.h:361:59: error: expected class member or base class name
  inline ScriptData(VALUE value) : Pointer<v8::ScriptData>(value) {}
                                                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [accessor.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/名前/dev/gameparty/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2 for inspection.
Results logged to /Users/名前/dev/gameparty/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/gem_make.out
Using sdoc 0.4.1
Using activesupport 4.2.5
Using loofah 2.0.3
Using xpath 2.0.0
Using rbvmomi 1.8.2
Using selenium-webdriver 2.45.0
Using oauth2 1.0.0
Using fog-json 1.0.2
Using fog-xml 0.1.2
Using fog-local 0.3.0
Using fog-vmfusion 0.1.0
Using omniauth-oauth 1.1.0
Using pry-byebug 3.3.0
Using pry-rails 0.3.4
An error occurred while installing therubyracer (0.12.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.

解決策

下記のやり方をしたところ、問題は解消されました。

gem uninstall libv8
gem uninstall therubyracer
brew rm v8

brew tap homebrew/dupes
brew install apple-gcc42

brew tap homebrew/versions
brew install v8-315
brew link --force v8-315

gem install libv8 -- --with-system-v8
gem install therubyracer

bundle config --local build.libv8 --with-cxx=/usr/local/bin/g++-4.2
bundle install

参考にしたサイト

下記のサイトを特に参考にさせていただきました
Install therubyracer gem on OSX 10.11 El Capitan
Can't install on El Capitan #402
therubyracerが入らない

何が問題でどうして解決できたのかが分かっていないため、詳細にご説明できず申し訳ございません。
(gcc(コンパイラ)などの本質的理解ができていないため、
この辺勉強するといいと思うなどありましたら、ご教授いただけるとありがたいです。)

17
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
13