読者です 読者をやめる 読者になる 読者になる

青いの

睡眠に関するあれこれや、技術メモ、ゲームの感想、その他いろいろ。

またlibv8, therubyracer, Yosemiteでハマる、でも

以前こちら↓で触れた話題

libv8とtherubyracer入らない問題にわたしもハマったメモ - 青いの

 

この時はlibv8とtherubyracerの適切なversionを調べてちゃんと適合しあうやつを入れましょうね、という解決法だったのですが…

 

他の環境用にapple-gcc42を消したりgccまわりを入れなおしたりした影響なのか、これだけでは解決できない事態に見舞われました。

 

bundle installでエラーがばばーっと

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

/Users/ino/.rbenv/versions/2.1.3/bin/ruby extconf.rb
checking for main() in -lobjc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic'
rr.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
1 warning generated.
compiling v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_array.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_callbacks.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_context.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_date.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_debug.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_exception.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_exception.cpp:10:16: warning: unused variable 'stack' [-Wunused-variable]
static void* stack[20];
^
1 warning generated.
compiling v8_external.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_external.cpp:10:9: warning: unused variable 'references' [-Wunused-variable]
VALUE references;
^
1 warning generated.
compiling v8_function.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_handle.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_locker.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_locker.cpp:45:5: warning: control reaches end of non-void function [-Wreturn-type]
}
^
v8_locker.cpp:85:5: warning: control reaches end of non-void function [-Wreturn-type]
}
^
2 warnings generated.
compiling v8_message.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_object.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_object.cpp:77:19: warning: unused variable 'proto' [-Wunused-variable]
Handle<Value> proto(rr_rb2v8(prototype));
^
1 warning generated.
compiling v8_script.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_string.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_template.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_try_catch.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_v8.cpp
clang: warning: argument unused during compilation: '-rdynamic'
compiling v8_value.cpp
clang: warning: argument unused during compilation: '-rdynamic'
v8_value.cpp:100:9: warning: unused function 'ToInt32' [-Wunused-function]
VALUE ToInt32(VALUE self) {
^
1 warning generated.
compiling v8_weakref.cpp
clang: warning: argument unused during compilation: '-rdynamic'
linking shared-object v8.bundle
clang: error: no such file or directory: '/Users/ino/rh/hogehoge/vendor/bundle/ruby/2.1.0/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'
make: *** [v8.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ino/rh/hogehoge/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.10.2 for inspection.
Results logged to /Users/ino/rh/hogehoge/vendor/bundle/ruby/2.1.0/extensions/x86_64-darwin-14/2.1.0-static/therubyracer-0.10.2/gem_make.out
An error occurred while installing therubyracer (0.10.2), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.10.2'` succeeds before bundling.

 

--with-system-v8 等のオプションをつけても、目当て以外のlibv8をuninstallしても、brew upgradeその他あれこれ更新してもだめ。

Xcode command line toolも最新。


調べてみるとやはりというかなんというかapple-gcc47入れろって解決案ばかり出てきて、うええ〜せっかく別の入れたのに〜〜って尻込みをしていたところ…

stackoverflow.com

 

# after failing create link from brew installed v8 to error location
ln -s /usr/local/Cellar/v8/3.21.17/lib/libv8_base.x64.a /Users/mscottford/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a

えっ…

 

 

 

でも確かにわたしもlibv8もv8も入っているのに

clang: error: no such file or directory: '/Users/ino/rh/hogehoge/vendor/bundle/ruby/2.1.0/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'
make: *** [v8.bundle] Error 1

って言われているんですよね。

 

なので上記コメントと同じ様に、その見つからないよ!と言われている場所へlibv8本体っぽいもののシンボリックリンクを貼ってみました。

ln -s /usr/local/Cellar/v8/4.1.0.27/lib/libv8_base.a /Users/ino/rh/hogehoge/vendor/bundle/ruby/2.1.0/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a

 

あんまり期待せずbundle install

Bundle complete! 22 Gemfile dependencies, 89 gems now installed.
Bundled gems are installed into ./vendor/bundle.

かっ、解決した…!!

あんなに色々試したのに!w