rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.67k stars 190 forks source link

Unable to install on OS X 10.11.4 with Ruby 2.2.4 #405

Closed Geesu closed 8 years ago

Geesu commented 8 years ago

I'm just simply trying to run gem install therubyracer and I'm receiving the following errors:

/Users/graceficke/.rbenv/versions/2.2.4/bin/ruby -r ./siteconf20160404-60041-1d63bmg.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:360:33: error: use of undeclared identifier 'nullptr'
  V8_INLINE MaybeLocal() : val_(nullptr) {}
                                ^
/usr/local/include/v8.h:367:51: error: use of undeclared identifier 'nullptr'
  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
                                                  ^
/usr/local/include/v8.h:371:29: error: use of undeclared identifier 'nullptr'
    out->val_ = IsEmpty() ? nullptr : this->val_;
                            ^
/usr/local/include/v8.h:437:50: error: use of undeclared identifier 'nullptr'
  bool IsFirstPass() const { return callback_ != nullptr; }
                                                 ^
/usr/local/include/v8.h:808:42: error: use of undeclared identifier 'nullptr'
  V8_INLINE Global() : PersistentBase<T>(nullptr) {}
                                         ^
/usr/local/include/v8.h:833:18: error: use of undeclared identifier 'nullptr'
    other.val_ = nullptr;
                 ^
/usr/local/include/v8.h:845:18: error: use of undeclared identifier 'nullptr'
      rhs.val_ = nullptr;
                 ^
/usr/local/include/v8.h:1110:52: error: use of undeclared identifier 'nullptr'
                            ScriptOrigin* origin = nullptr));
                                                   ^
/usr/local/include/v8.h:1113:30: error: use of undeclared identifier 'nullptr'
      ScriptOrigin* origin = nullptr);
                             ^
/usr/local/include/v8.h:3242:36: error: use of undeclared identifier 'nullptr'
    return NewInstance(context, 0, nullptr);
                                   ^
/usr/local/include/v8.h:4457:57: error: use of undeclared identifier 'nullptr'
      experimental::FastAccessorBuilder* fast_handler = nullptr,
                                                        ^
/usr/local/include/v8.h:4473:57: error: use of undeclared identifier 'nullptr'
      experimental::FastAccessorBuilder* fast_handler = nullptr);
                                                        ^
/usr/local/include/v8.h:7292: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 ','
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [accessor.o] Error 1

make failed, exit code 2

I have tried the following as well, but it is the same error:

brew tap homebrew/versions
brew install v8-315
brew link --force v8-315
gem install libv8 -- --with-system-v8
gem install therubyracer``` 
desireco commented 8 years ago

I have the same problem. I tried number of things, including reinstalling all rubies, as well as different combination of libv8 and rubyracer as it seems that interface has changed. However I was not succesfull figuring this out.

Geesu commented 8 years ago

What's odd is I was able to get it working with the above on MY macbook pro, and I have no idea why. This was after spending 2 hours trying to get it work on my co-worker's mac, which I still haven't been able to complete (hence the issue).

desireco commented 8 years ago

Same here. It works on my laptop, on desktop I just can't make it work and I was hoping during weekend to use bigger screen to work through some stuff. Both are with updated software. So I don't know. Wish I know where else to look.

EricBoersma commented 8 years ago

Also seeing this problem. Fresh install of El Capitan, can't install therubyracer.

EricBoersma commented 8 years ago

For those struggling with this, I was able to follow the steps included in the accepted answer on This StackOverflow question. Specifically the parts about using the 4.2.2 GCC for building libv8 in the bundler config. That workaround has worked for me.

Geesu commented 8 years ago

Shux, I was really hoping that would do it @EricBoersma but I receive this error: https://gist.github.com/Geesu/5e93aec94ed4962dcbc85a8c509784fc

im-kulikov commented 8 years ago
brew tap homebrew/versions
brew install v8-315
brew link --force v8-315
gem install libv8 -- --with-system-v8
gem install therubyracer

solved my problem, thanx @Geesu

Southern commented 8 years ago

I was able to use this to finally get it working:

brew install v8-315
bundle config --local build.libv8 --with-system-v8
bundle config --local build.therubyracer --with-v8-dir=/usr/local/opt/v8-315
bundle install
desireco commented 8 years ago

Strangely, this solved my problem. Thank you. I kind of not sure why this would work and normal ways wouldn't. But happy it does work.

Southern commented 8 years ago

Yeah. It took me 2 days to figure this out. Tried all of the combinations in this issue with no luck, some from StackOverflow, and finally hit this one. Glad it helped.

desireco commented 8 years ago

Thank you. I think this solves it.

avatsaev commented 8 years ago

@im-kulikov yes this worked, thanks

Geesu commented 8 years ago

Yes that did it!

ronnietaylor commented 8 years ago

issuecomment-209169869 worked for me. Thanks!

KudosX commented 8 years ago

thanks southern!!

issuecomment-209169869 worked for me with rails 5.0.0.beta3.

that was painful finding a solution. I have no idea how you figured that one out but, sure glad you did!

Southern commented 8 years ago

It was pure luck. I just started working with Ruby/Rails like 3 days ago, and most of that time was spent looking for this solution.

Glad it's working for everyone though.

haaayden commented 8 years ago

Thank you!

ignisf commented 8 years ago

There has been a new release of libv8 that should address most OS X install issues. Closing for now.