rubyjs / therubyracer

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

Symbol not found when running Rails server #392

Closed jasonlynes closed 8 years ago

jasonlynes commented 8 years ago

Having trouble finding answers elsewhere...

OSX El Capitan 10.11.1 Ruby 2.2.2 (Rbenv) Rails 4.2.4

I successfully installed therubyracer 0.12.2 and libv8 3.16.14.13, and successfully ran bundle install, but when i run puma or rails s I get the following error:

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/jason/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/jason/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

Trace/BPT trap: 5
jasonlynes commented 8 years ago

Switched to Ruby 2.0.0, everything else the same. Reinstalled the gems and no such server errors.

cowboyd commented 8 years ago

Did you uninstall all copies of libv8 and also remove all sticky --with-system-v8 flags, and remove any brew installed v8 for good measure? .

phuongnd08 commented 8 years ago

Without brew installed v8 I won't be able to install therubyracer on Mac.

nynhex commented 8 years ago

Anyone get a resolution to this? I'm having the same issues with Rails 4.2.1 and Ruby 2.2.2 on El Capitan

zhyliana commented 8 years ago

+1

Same issues with Rails 3.2.22 and Ruby 2.1.6p336 also on El Capitan

$ bundle exec thin start -p 3000   # same results when simply running bundle exec rails s
dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/Zhyliana/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/Zhyliana/.rbenv/versions/2.1.6/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-15/2.1.0-static/therubyracer-0.12.2/v8/init.bundle
  Expected in: flat namespace

This issue arose after switching from rvm to rbenv and @jasonlynes is also using rbenv. @phuongnd08 @shakycode, are you also using rbenv and/or made a recent switch? I've seen your posts on other issues that came up involving v8, libv8, and therubyracer.

derotune commented 8 years ago

same problem on el capitan

cleytonmessias commented 8 years ago

+1

sergeygaychuk commented 8 years ago

same problem on el capitan

saurabhnanda commented 8 years ago

Same problem. Tried the solution given at http://stackoverflow.com/questions/33475709/install-therubyracer-gem-on-osx-10-11-el-capitan but still getting the following error:

    /Users/saurabhnanda/.rvm/gems/ruby-2.2.1@vl/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/saurabhnanda/.rvm/gems/ruby-2.2.1@vl/gems/therubyracer-0.12.0/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/saurabhnanda/.rvm/gems/ruby-2.2.1@vl/gems/therubyracer-0.12.0/lib/v8/init.bundle
  Expected in: flat namespace
charlotte-miller commented 8 years ago

+1

bookinstock commented 8 years ago

+1 and when I switched back to ruby 2.0.0, same errors still appeared.

P1X3L commented 8 years ago

+1 exact same problem

nishants commented 8 years ago

Same problem here too(ruby 2.1.4p265 ; ElCapiton)

sun-yr commented 8 years ago

same problem ruby: 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15] os: El Capitan

zoontek commented 8 years ago

This works for me (on El Capitan):

gem uninstall libv8
gem uninstall therubyracer
brew rm v8 (or v8-315)

brew tap homebrew/dupes
brew install apple-gcc42
bundle config --local build.libv8 --with-cxx=/usr/local/bin/g++-4.2
bundle install
ldrbrandon commented 8 years ago

I'm still experiencing this issue. libv8 won't install successfully. I'm on mac os 10.11.4, ruby 1.9.3-p551 I did the above sequence but bundle install failed and logged this:

1 error generated.
make[1]: *** [/Users/bdog/.rvm/gems/ruby-1.9.3-p551/gems/libv8-3.16.14.7/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o] Error 1
make: *** [x64.release] Error 2
/Users/bdog/.rvm/gems/ruby-1.9.3-p551/gems/libv8-3.16.14.7/ext/libv8/location.rb:36:in `block in verify_installation!': libv8 did not install properly, expected binary v8 archive
ignisf commented 8 years ago

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

rbudiharso commented 5 years ago

This happens to me

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/rbudiharso/.asdf/installs/ruby/2.2.10/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-18/2.2.0-static/therubyracer-0.12.1/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/rbudiharso/.asdf/installs/ruby/2.2.10/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-18/2.2.0-static/therubyracer-0.12.1/v8/init.bundle
  Expected in: flat namespace

[1]    97505 abort      bundle exec rails s

Mac OS Mojave, ruby 2.2.10

bstawitz commented 5 years ago

Same problem.

Mac OS Mojave ruby 2.3.5

gbenedict commented 4 years ago

I just ran into this problem on macOS Catalina. I could not install with 0.12.2, but I could with 0.12.3.

  1. brew install v8-315
  2. gem install libv8 -v='3.16.14.19' -- --with-system-v8
  3. gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15
  4. bundle update therubyracer

This was with an older Rails 4.0.8 application running Spree.

wheresmyconcrete commented 4 years ago

Thank you gbenedict. It worked for me.

kevmmdev commented 3 years ago

I am having this issue on Mac m1, it was already a painful to install therubyracer and to successfully bundle install, and in the end I am facing this issue.

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/kevin/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/kevin/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

zsh: abort      rails s
peripheralist commented 3 years ago

@electricfeel1979 I'm also on a Mac M1 and had the same experience with therubyracer, currently running into your issue on bundle exec. Have you gotten anywhere?

cheesepaulo commented 3 years ago

I am having this issue on Mac m1, it was already a painful to install therubyracer and to successfully bundle install, and in the end I am facing this issue.

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/kevin/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/kevin/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

zsh: abort      rails s

same here, m1 Big Sur 11.2.1 ( rbenv native ruby 2.6.4 )

taco-chen commented 3 years ago

Same here at M1 Big Sur 11.3 (ruby 2.7.3)

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/weifanchen/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/weifanchen/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

[1]    67201 abort      bundle exec rails c
markcelsor commented 3 years ago

Same here at M1 Big Sur 11.3 (ruby 2.7.3)

dyld: lazy symbol binding failed: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/weifanchen/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v82V821AddGCPrologueCallbackEPFvNS_6GCTypeENS_15GCCallbackFlagsEES1_
  Referenced from: /Users/weifanchen/.asdf/installs/ruby/2.7.3/lib/ruby/gems/2.7.0/gems/therubyracer-0.12.3/lib/v8/init.bundle
  Expected in: flat namespace

[1]    67201 abort      bundle exec rails c

I was finally able to get past this on my M1 Big Sur 11.4 (ruby 2.7.2) by installing brew, v8, libv8, and therubyracer individually using arch -x86_64. Initially I wasn't installing the gems with it and it was causing the error above.

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias ibrew='arch -x86_64 /usr/local/bin/brew'
ibrew install v8@3.15
arch -x86_64 gem install libv8 -v '3.16.14.19' -- --with-system-v8 
arch -x86_64 gem install therubyracer -v '0.12.3' -- --with-v8-dir=/usr/local/opt/v8@3.15
pinkyrout commented 3 years ago

Mac OS Big Sur Issue solve for mini-racer gem: I faced similar error with mini_racer gem. I updated the version from 3.0.1 to 4.0.0 in my gemfile and it worked. Not getting any error now. Mostly it is the problem of version. Sometimes the version of the gem is not compatible with our OS version and this problem can occur. I was using macOS Big Sur. Many old versions of gems are not compatible with it.

atticusliu commented 2 years ago

I've been following along with a new M1 machine and having the usual troubles above. After following @markcelsor's instructions and executing basic rails commands, I'm seeing errors along the lines of:

.../lib/v8/init.bundle, 9) no suitable image found. Did find: (LoadError) .../gems/therubyracer-0.12.3/lib/v8/init.bundle: mach-o, but wrong architecture .../gems/therubyracer-0.12.3/lib/v8/init.bundle: mach-o, but wrong architecture - .../gems/therubyracer-0.12.3/lib/v8/init.bundle

Can't seem to find any other resource that covers therubyracer and wrong architecture issues. Using macOS Big Sur.

wbharding commented 2 years ago

After a couple hours research on this, I moved to mini_racer, which allowed me to get Rails started and doesn't need the alternate version of the v8 gem. Given that therubyracer hasn't been maintained in several years, this might be a good time for others to consider the switch. I'll post again if I run into any issues in our app from the change.