Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails s -> dyld: lazy symbol binding failed: Symbol not found: _rb_intern2

So rails s doesnt work along with rails generate. I thought the issue was heroku toolbelt, so I removed it but that didn't do the trick. I then checked my .zshrc file and saw that it had a different version of ruby that it was calling in the PATH, so I updated that. However that didn't do it. I'm out of ideas. Can someone help, please?

#( 05/06/13@10:01AM )( admin@Administrators-MacBook-Pro ):~/desktop/scratch rails s dyld: lazy symbol binding failed: Symbol not found: _rb_intern2 Referenced from: /Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle Expected in: flat namespace

dyld: Symbol not found: _rb_intern2
  Referenced from: /Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle
  Expected in: flat namespace

[1]    69741 trace trap  rails s

#( 05/06/13@10:02AM )( admin@Administrators-MacBook-Pro ):~/desktop/scratch rvm list default

Default Ruby (for new shells)

   ruby-1.9.3-p392 [ x86_64 ]

#( 05/06/13@10:11AM )( admin@Administrators-MacBook-Pro ):~/desktop/scratch ruby -v

ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

#( 05/06/13@10:11AM )( admin@Administrators-MacBook-Pro ):~/desktop/scratch rails -v

Rails 3.2.12

gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
# gem 'pg'
gem "bootstrap-sass", ">= 2.3.0.0"

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

.zshrc file:

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="junkfood"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export PATH=//opt/local/bin:/opt/local/sbin://usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/Users/admin/.rvm/gems/ruby-1.9.3-p392/bin:/Users/admin/.rvm/gems/ruby-1.9.3-p392@global/bin:/Users/admin/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/admin/.rvm/bin:/usr/local/mysql/bin:/Users/admin/.rvm/bin

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
like image 283
Pavan Katepalli Avatar asked May 06 '13 14:05

Pavan Katepalli


1 Answers

Similar errors of the form:

Symbol not found: {some-symbol}
Referenced from: /path/to/some/file.bundle
Expected in: flat namespace

seem to crop up for a lot of gems.

The underlying issue seems to be an incompatible C extension library (in the above case, sqlite3_native.bundle). It seems that for whatever reason, the gem was installed for an older version of ruby, and the current ruby version doesn't have the exported C method that the extension library is looking for.

There are 2 ways to solve this

  • Uninstall & reinstall the package (as pointed out in Shawn Balestracci's comment above). In the above case, we can infer that the package is sqlite3:

    gem uninstall {package}; gem install {package}

OR (less preferable, but might be useful if above method fails for some reason):

  • Remove the bundle file and reinstall the package. Looking at the error message: Referenced from: /Users/admin/.rvm/gems/ruby-1.9.3-p392/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle, we just need to:

    rm {path-to-bundle-file}; gem install {package}

like image 120
Aneil Mallavarapu Avatar answered Sep 22 '22 04:09

Aneil Mallavarapu