开发者

Sqlite-3 error while running ROR application

开发者 https://www.devze.com 2023-01-02 18:11 出处:网络
When i try to run Ruby on Rails application.... i facin开发者_StackOverflowg the following error symbol lookup error: /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sql

When i try to run Ruby on Rails application.... i facin开发者_StackOverflowg the following error

symbol lookup error: /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/sqlite3-ruby-1.3.0/lib/sqlite3/sqlite3_native.so: undefined symbol: sqlite3_initialize

I don't know whats the error exactly. can any one please help me out this......


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'


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.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号