no such file to load sqlite3

B

Ben Johnson

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.
 
R

Robert Dober

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.
 
D

David Dennis

Robert said:
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 by
`sqlite3_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

2) 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.
 
D

Damjan Rems

David said:
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 by
`sqlite3_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

2) 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
 
D

David Dennis

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
 
S

Saji N. Hameed

* Damjan Rems said:
David Dennis 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 (e-mail address removed)
KOREA
 
R

Robert Dober

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


--=20
Ne baisse jamais la t=EAte, tu ne verrais plus les =E9toiles.

Robert Dober ;)
 
D

David Dennis

Robert said:
Oops so sorry, you had a problem during installation not using the
gem, my mistake.
Sorry for having wasted your time.
Sincere apologies.
Robert

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

Thanks, David
 
D

David Dennis

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.
 
D

David Dennis

David said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top