sqlite3

If I install sqlite3-ruby using gem, I get this error..

   LoadError: no such file to load -- sqlite3/database

I saw this post..

   "no such file to load -- sqlite3" Rails - Rails - Ruby-Forum

And it seems that this is most commonly a problem if people don't have the sqlite3 libraries and headers installed when they build the sqlite3-ruby module. I've got those.

"gem install sqlite3-ruby" only populates

    /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2

but if I download the gem from rubyforge, and build and install it by hand, it puts stuff in both...

    /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2     /usr/lib/ruby/site_ruby/1.8/sqlite3

and creates /usr/lib/ruby/site_ruby/1.8/i686-linux/sqlite3_api.so.. which takes of the "LoadError: no such file to load..." problem.

Any ideas why installing sqlite3 via gem doesn't work, but building it by hand does?

What platform are you running this on?

We're using a locally developed LFS based linux distribution. No easy access to widely used package management (yum, apt, rpm).

I do have ruby 1.8.6 (not p230 - that was causing issues). Linux 2.6.23.1, glibc 2.3.6, sqlite 3.5.9 installed from source.

As far as I know, the other gems we're using are working ok.

Hhmm ... it seems like something is missing to me with the install. I'm not sure if there is something ruby might be missing?

Oh yeah.. this is Rails 2.1.

when you built the gem did you tell it where to find the sqlite
headers. Did it print the 'building native extension' blurb ?

Fred

Yup..

# gem install sqlite3-ruby Building native extensions. This could take a while... Successfully installed sqlite3-ruby-1.2.2 1 gem installed Installing ri documentation for sqlite3-ruby-1.2.2... Installing RDoc documentation for sqlite3-ruby-1.2.2...

LoadError: no such file to load -- sqlite3/database

I found this evening that I have this same issue on a new Debian install.

dpkg -l|grep sqlite3

ii libsqlite3-0 3.3.8-1.1         SQLite 3 shared library ii libsqlite3-dev 3.3.8-1.1         SQLite 3 development files ii libsqlite3-ruby 1.1.0-2         SQLite3 interface for Ruby ii libsqlite3-ruby1.8 1.1.0-2         SQLite3 interface for Ruby 1.8 ii sqlite3 3.3.8-1.1         A command line interface for SQLite 3

gem list --local

actionmailer (2.1.0) actionpack (2.1.0) activerecord (2.1.0) activeresource (2.1.0) activesupport (2.1.0) hoe (1.6.0) mysql (2.7) paginator (1.1.1) rails (2.1.0) rake (0.8.1) rcov (0.8.1.2.0) rubyforge (1.0.0) sqlite3-ruby (1.2.2)

ruby -v

ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux]

uname -a

Linux mercury 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux

An older version seems to work.

gem uninstall sqlite3-ruby

gem install sqlite3-ruby -v=1.2.1

I find I get a /more/ complete installation when I install 1.2.1 via gem, but still not functional.

The only method that really seems to work for me is to download the gem from rubyforge and to build and install it by hand. :\

Thanks for the suggestions! On a Mac (10.4.11) I was having this issue with a new Rails 2.1 app. Downgrading to 1.2.1 worked perfectly.