Problem loading a SQLite3 database on Debian 3.1

Hi all,

I try to figure out why a small Rails application doesn’t run and the
problem seems to be that the DB file apparently can’t be opened.
So, yes sqlite3-ruby is installed (via gem) and sqlite3 itself is also
installed and running (the sqlite3 command is available and I can run
select statements etc.).

Only if I try to open that very DB file from Ruby an exception is
raised.
I don’t think this should be necessary, but I also copied libsqlite3.so
into the $LOAD_PATH - to no avail.

This is on a Debian 3.1 Linux machine.

sqlite3 -version # => 3.3.5
ruby -v # => ruby 1.8.4 (2005-12-24) [i686-linux]

Here’s what I get form irb:

irb(main):001:0> require ‘English’
=> true
irb(main):002:0> require ‘sqlite3’
=> true
irb(main):003:0> $LOAD_PATH
=> ["/usr/local/lib/ruby/site_ruby/1.8",
“/usr/local/lib/ruby/site_ruby/1.8/i686-linux”,
“/usr/local/lib/ruby/site_ruby”, “/usr/local/lib/ruby/1.8”,
“/usr/local/lib/ruby/1.8/i686-linux”, “.”]
irb(main):004:0> db = SQLite3::Database.new( “example.db3” )
RuntimeError: libsqlite3.so: cannot open shared object file: No such
file or directory
from /usr/local/lib/ruby/1.8/dl/import.rb:29:in initialize' from /usr/local/lib/ruby/1.8/dl/import.rb:29:indlload’
from /usr/local/lib/ruby/1.8/dl/import.rb:27:in dlload' from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/driver/dl/api.rb:63 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/driver/dl/driver.rb:33
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' from /usr/local/lib/ruby/site_ruby/1.8/sqlite3/database.rb:642:inload_driver’
from
/usr/local/lib/ruby/site_ruby/1.8/sqlite3/database.rb:640:in
load_driver' from /usr/local/lib/ruby/site_ruby/1.8/sqlite3/database.rb:107:ininitialize’
from (irb):4

Now, I appreciate all ideas how to get this going.

Happy rubying everybody

Stephan

On 25/07/06, Stephan Kämper [email protected] wrote:

irb(main):004:0> db = SQLite3::Database.new( “example.db3” )
RuntimeError: libsqlite3.so: cannot open shared object file: No such
file or directory

It’s not finding the sqlite library (DLL) and the remaining errors sound
like
it’s trying to use the shared lib via ruby/dl.

Try rebuilding the gem so it uses SWIG instead. See the instructions at:

http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3

Dick D. wrote:

Try rebuilding the gem so it uses SWIG instead. See the instructions at:

http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3

Thanks a lot. This is it.

Happy rubying

Stephan