No such file to load sqlite3


#1

Ever since I updated my gems I have been getting the following error any
time I want to use sqlite in ruby:

no such file to load – sqlite3 (MissingSourceFile)

I tracked it down to a problem with do_sqlite3. So I decided to just do
a “gem uninstall do_sqlite3”. All went well but when I type “gem list”
do_sqlite3 still shows up and I am still getting the error. When I go
into to my gems folder there is no do_sqlite3 folder. So rubygems is
saying its installed, but its not and I think it is still trying to load
it.

Any ideas on what is going on, or how I can refresh my ruby gems list?
Thanks.


#2

On Tue, Nov 25, 2008 at 10:38 AM, Ben J. removed_email_address@domain.invalid
wrote:

Ever since I updated my gems I have been getting the following error any
time I want to use sqlite in ruby:

no such file to load – sqlite3 (MissingSourceFile)
Did you do the threaded
require ‘rubygems’
R.


#3

Robert D. wrote:

On Tue, Nov 25, 2008 at 10:38 AM, Ben J. removed_email_address@domain.invalid
wrote:

Ever since I updated my gems I have been getting the following error any
time I want to use sqlite in ruby:

no such file to load – sqlite3 (MissingSourceFile)
Did you do the threaded
require ‘rubygems’
R.

Hi,

Could you explain this more? I have seen this error reported over and
over throughout the internet but no concise explanation is to be found.

Suggestions are:

  1. gem install sqlite3-ruby

but then I get this error:

Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install sqlite3-ruby
checking for fdatasync() in -lrt… yes
checking for sqlite3.h… no

make
make: *** No rule to make target ruby.h', needed bysqlite3_api_wrap.o’. Stop.

Gem files will remain installed in
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

  1. sudo gem install sqlite3-ruby

But unfortunately I don’t have admin access to my dedicated server

The binary works correctly which is the most annoying part. When I type
‘sqlite3’ I get a prompt for playing with the database. I also get the
same “no such file to load – sqlite3” when I run the first “db:create”
after creating a demo app.

sqlite3 works with rails on my local windows PC. I don’t understand why
it’s so impossible on the linux box.

Thanks, David.


#4

It is not impossible but it is unfortunate litle more complicated. With
windows you already get compiled binary needed for sqlite3-ruby to work.

With Linux binary has to be compiled for your distribution and here it
is almost essential that you have admin rights.

I guess you are on Ubuntu. So you need to:
sudo apt-get install build-essential ruby1.8-dev libsqlite3-dev

First one is compiler environment
Second are ruby headers needed to compile addons with ruby
Third are sqlite3 headers

by
TheR

Thanks for the quick response!

That command doesn’t seem to work. I don’t think I have ubuntu. I think
it’s redhat. Do you know how I would do the same thing on redhat?

Thanks, David


#5

David D. wrote:

Robert D. wrote:

On Tue, Nov 25, 2008 at 10:38 AM, Ben J. removed_email_address@domain.invalid
wrote:

Ever since I updated my gems I have been getting the following error any
time I want to use sqlite in ruby:

no such file to load – sqlite3 (MissingSourceFile)
Did you do the threaded
require ‘rubygems’
R.

Hi,

Could you explain this more? I have seen this error reported over and
over throughout the internet but no concise explanation is to be found.

Suggestions are:

  1. gem install sqlite3-ruby

but then I get this error:

Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install sqlite3-ruby
checking for fdatasync() in -lrt… yes
checking for sqlite3.h… no

make
make: *** No rule to make target ruby.h', needed bysqlite3_api_wrap.o’. Stop.

Gem files will remain installed in
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

  1. sudo gem install sqlite3-ruby

But unfortunately I don’t have admin access to my dedicated server

The binary works correctly which is the most annoying part. When I type
‘sqlite3’ I get a prompt for playing with the database. I also get the
same “no such file to load – sqlite3” when I run the first “db:create”
after creating a demo app.

sqlite3 works with rails on my local windows PC. I don’t understand why
it’s so impossible on the linux box.

Thanks, David.

It is not impossible but it is unfortunate litle more complicated. With
windows you already get compiled binary needed for sqlite3-ruby to work.

With Linux binary has to be compiled for your distribution and here it
is almost essential that you have admin rights.

I guess you are on Ubuntu. So you need to:
sudo apt-get install build-essential ruby1.8-dev libsqlite3-dev

First one is compiler environment
Second are ruby headers needed to compile addons with ruby
Third are sqlite3 headers

by
TheR


#6

David D. wrote:

It is not impossible but it is unfortunate litle more complicated. With
windows you already get compiled binary needed for sqlite3-ruby to work.

With Linux binary has to be compiled for your distribution and here it
is almost essential that you have admin rights.

Maybe it is not necessary to have admin rights. I did this on a machine
that I did not have admin rights. Basically I compiled sqlite3
after changing prefix to point to a directory of my choice.

Second I installed ruby and ruby gems in my local
directory, instead of system-wide location.

I don’t remember the exact steps, but once the above two steps are done,
you have a lot of control on where the gems compile and so on and it
should be possible to get the sqlite3-ruby compiled in your own
directory.

hope this helps,

saji

Saji N. Hameed

APEC Climate Center +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed_email_address@domain.invalid
KOREA


#7

On Tue, Dec 2, 2008 at 7:53 AM, David D. removed_email_address@domain.invalid
wrote:

Hi,

Could you explain this more? I have seen this error reported over and
over throughout the internet but no concise explanation is to be found.
Oops so sorry, you had a problem during installation not using the
gem, my mistake.
Sorry for having wasted your time.
Sincere apologies.
Robert


Ne baisse jamais la tête, tu ne verrais plus les étoiles.

Robert D. :wink:


#8

Well, I think you might have a point. I’ll try what you’re suggesting
and see if that works.

Thanks, David

OK, I’ve tried to compile it locally and I have a basic question. How
is it possible that I can run “sqlite3” and use the binary myself from
the command line but Rails keeps sending me back “no such file to load
– sqlite3” errors? This seems very non-intuitive and un-rails-like.


#9

Robert D. wrote:

On Tue, Dec 2, 2008 at 7:53 AM, David D. removed_email_address@domain.invalid
wrote:

Hi,

Could you explain this more? I have seen this error reported over and
over throughout the internet but no concise explanation is to be found.
Oops so sorry, you had a problem during installation not using the
gem, my mistake.
Sorry for having wasted your time.
Sincere apologies.
Robert


Ne baisse jamais la t�te, tu ne verrais plus les �toiles.

Robert D. :wink:

Well, I think you might have a point. I’ll try what you’re suggesting
and see if that works.

Thanks, David


#10

David D. wrote:

Well, I think you might have a point. I’ll try what you’re suggesting
and see if that works.

Thanks, David

OK, I’ve tried to compile it locally and I have a basic question. How
is it possible that I can run “sqlite3” and use the binary myself from
the command line but Rails keeps sending me back “no such file to load
– sqlite3” errors? This seems very non-intuitive and un-rails-like.

OK…for some reason this worked:

gem install --version 1.2.3 sqlite3-ruby