Sqlite-3 error while running ROR application

后端 未结 4 1377
礼貌的吻别
礼貌的吻别 2020-12-18 08:51

When i try to run Ruby on Rails application.... i facing the following error

symbol lookup error: /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/sqlite3-ruby-1.3.0/l

相关标签:
4条回答
  • 2020-12-18 09:05

    If you lock your gemfile to sqlite3-ruby you will have problems starting your application on recent Rails versions since Rails wants to have the gem named "sqlite3". The real solution to this problem is to ensure that the .bundle file that the gem creates indeed links to the right sqlite3 libraries.

    By default, sqlite3 gem will link to a nonexisting library in your /usr/lib. This is NOT right. What you need to do is set the compliation options straight for your system and reinstall the sqlite3 gem, and you can easily do this using

    $bundle config
    

    Their manpage specifies what it does, but this is the command that I needed to do (I have a roll-your-own SQLite install from their site, not via brew or macports).

    $bundle config build.sqlite3 --with-sqlite3-include=/usr/local/include --with-sqlite3-lib=/usr/local/lib
    

    This will always feed the right options to the gem when you try to "bundle install" it and your gem will build properly.

    Note that this problem is kinda sneaky in that it will not occur on Ruby 1.9 - apparently rbconfig there has been updated and does better library lookup. But when you are going for 1.8 compatibility - use this bundle configuration and you will be all set.

    0 讨论(0)
  • 2020-12-18 09:09

    I had the same issue this morning after upgrading sqlite3-ruby to 1.3.0. A quick fix is to uninstall 1.3.0 and ensure 1.2.5 is installed:

    gem uninstall sqlite3-ruby --version 1.3.0
    gem install sqlite3-ruby --version 1.2.5
    

    The better option is to set your gem config to ignore 1.3.0. For Rails 2.x, in config/environment.rb:

    config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '!= 1.3.0'
    

    or if you want it play it really safe, explicitly pull in 1.2.5:

    config.gem 'sqlite3-ruby', :lib => 'sqlite3', :version => '1.2.5'
    
    0 讨论(0)
  • 2020-12-18 09:09

    I'm had the same issue on my Dreamhost server:

    > bundle exec rails c 
    ruby: symbol lookup error: /home/user/settings/installs/rubygems/gems/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize
    

    I downloaded and installed SQLite3 manually in my home directory, and added LD_LIBRARY_PATH to my .bashrc. This fixed the Rails console issue.

    However, I still haven't gotten the app to launch in passenger yet, I'm still working on it.

    0 讨论(0)
  • 2020-12-18 09:09

    Ruby Enterprise Edition installs the sqlite3 gem automatically, and 1.3.0 seems to be the problem.

    If your Rails app doesn't need sqlite3, try uninstalling the gem and restarting your app.

    sudo gem uninstall sqlite3
    
    0 讨论(0)
提交回复
热议问题