Difficulty installing therubyracer 0.10.2 and apple-gcc42 on Mac OSX 10.12.6 Sierra
Asked Answered
P

1

1

The answer to this similar question doesn't solve my problem. Here is the answer from that question:

If you decide to use a newer therubyracer gem version, you will no longer have this problem

Otherwise:

brew tap homebrew/dupes # Thanks Tom
brew install apple-gcc42

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2

brew uninstall v8

gem uninstall libv8

gem install therubyracer -v '0.10.2' # specify version

The problem I'm running into with this solution is with apple-gcc42. When I run this line:

brew install apple-gcc42

I get the following error:

apple-gcc42: This formula either does not compile or function as expected on macOS
versions newer than Mavericks due to an upstream incompatibility.

If I ignore that error and try to gem install therubyracer -v '0.10.2' anyway, I get this:

current directory: /Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/therubyracer-0.10.2/ext/v8
/Users/wylliam/.rbenv/versions/1.9.3-p551/bin/ruby -r ./siteconf20170907-76249-1po4ii1.rb extconf.rb
checking for main() in -lobjc... yes
creating Makefile

current directory: /Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/therubyracer-0.10.2/ext/v8
make  clean

current directory: /Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/therubyracer-0.10.2/ext/v8
make
compiling rr.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
compiling v8_array.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_callbacks.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_context.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_date.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_debug.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_exception.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
compiling v8_handle.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_locker.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
compiling v8_object.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
compiling v8_string.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_template.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_try_catch.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_v8.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
compiling v8_value.cpp
clang: warning: argument unused during compilation: '-rdynamic' [-Wunused-command-line-argument]
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' [-Wunused-command-line-argument]
linking shared-object v8.bundle
clang: error: no such file or directory: '/Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'
make: *** [v8.bundle] Error 1

make failed, exit code 2

I've tried many other solutions, such as the other answers to the linked question, but most of them rely on apple-gcc42.

Propylene answered 7/9, 2017 at 19:51 Comment(5)
I'd highly suggest you try using a virtual ruby environment. Something like rbenv or rvm (i personally like rbenv!). This will configure a ruby environment that doesn't rely on whats installed with the system allowing you to download newer gems and actually run a supported ruby version. I use this on my Mac for Rails development.Agna
I use rbenv..Propylene
Also note, I don't get this problem on my Ubuntu machine, only on my Mac. I can just bundle install (with rvm) on Ubuntu.Propylene
Facing the same problem here, eager to know if you find a solution because I've been through so many possible SO threads and GitHub issues...Numerous
Unfortunately not Francois. Solution has just been run Ubuntu.Propylene
F
0

Why did you uninstall libv8? The error line in your output:

error: no such file or directory: '/Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a'

sounds like libv8 is missing. Try installing that? It seems to be looking for libv8-3.3.10.4, so maybe you have to specify the version?

Side note: V8 3.3.10.4 is from 2011, and not even the latest patch of the 3.3 branch, so it is pretty much guaranteed to be full of bugs that were discovered and fixed later, which may well be security relevant. Do not run untrusted code in there!

Flori answered 7/9, 2017 at 22:52 Comment(5)
I think the idea with uninstalling v8 is to get therubyracer to install the correct version of libv8 as a dependancy. However, I tried installing therubyracer with v8 installed through brew and with libv8 installed through rbenv. I've identified the version of libv8 I need for therubyracer to be 3.3.10.4, and this is the error message I get with that version of libv8 installed.Propylene
Side note: I'm working on someone else's project. Trust me, it's annoying how outdated their stuff is. The project isn't even that old, it bewilders me.Propylene
It sounds like the task is to figure out which package creates /Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8/build/v8/libv8.a -- my guess would have been gem install libv8 -v '3.3.10.4', but if that doesn't do it... Does that gem create the file elsewhere maybe, so you could manually copy it around? (I'm not familiar with brew or gem or rbenv; I know about V8 but this is not a V8 issue.)Flori
I have tried gem install libv8 -v '3.3.10.4' before gem install therubyracer -v '0.10.2' but it didn't work (same error messages). I'm trying installing an old version of Xcode, and using that to gem install libv8. It's one of the answers on the question I linked. It's worth a shot.Propylene
Some more information. When I do gem which libv8 after installing the version I need, I get: /Users/wylliam/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.4/lib/libv8.rb If I look around in that directory I have .../lib/libv8/v8/ but that folder doesn't contain libv8.aPropylene

© 2022 - 2024 — McMap. All rights reserved.