Wuhai’s Weblog

July 6, 2008

no such file to load — sqlite3/database

Filed under: ruby+rails — wuhai @ 1:00 am

This is RHEL5, Rails 2.1.0. I got this error message “no such file to load — sqlite3/database” after following the first example from book “Agile-Web-Development-Rails-2nd”. After searching around, finally found the answer at http://andrew.chalkley.org/post/39984897/fix-sqlite3-error-on-ruby-enterprise-edition:

cd /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/lib/sqlite3
sudo chmod +r *

Today I got this error when using ‘rake db:migrate’:

sqlite3_api.so: undefined symbol: RSTRING_PTR

The answer is at http://d.hatena.ne.jp/GARAPON/20080602/1212387419, the ruby version in RHEL5 is 1.8.5, so workaround is:

Put the following lines in file '/usr/lib/ruby/1.8/i386-linux/ruby.h':
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
#define RSTRING_LEN(s) (RSTRING(s)->len)

gem uninstall sqlite3-ruby
gem install sqlite3-ruby
rake db:migrate

Then do the above 'sudo chmod +r *' AGAIN to get rid of the 'no such file to load' error message.

[root@wpprdwf ~]# gem install mysql -- --with-mysql-lib=/usr/lib/mysql
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

Blog at WordPress.com.