How to fix sqlite3-ruby-1.2.2
I’ve experienced the problem a month ago but as I see in others blogs people still face it while trying to install/upgrade sqlite3-ruby gem up to version 1.2.2. Being installed the gem raises error on an attempt to access sqlite3 database or fire rake db:
commands.
rake aborted!
no such file to load -- sqlite3/database
Here is how I’ve fixed the issue with the sqlite3-ruby-1.2.2 gem on my home Gentoo box and some production servers running CentOS and Debian.
Add two following lines of code:
#define RSTRING_PTR(s) (RSTRING(s)->ptr)
#define RSTRING_LEN(s) (RSTRING(s)->len)
somewhere into file /usr/lib/ruby/1.8/i686-linux/ruby.h
(path may be slightly different depending on architecture of your system), and then re-install the gem:
$ sudo gem uninstall sqlite3-ruby
$ sudo gem install sqlite3-ruby
Note! Also, you may need to check and fix permissions of the newly installed files. On my system they were set to -rw-rw--w- (662)
instead of -rw-r--r-- (644)
.
Update: Gem update to sqlite3-ruby 1.2.3 has broken my system again. The error is not fixed (or better say not properly fixed) yet.