Forum: Ruby no such file to load sqlite3

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
328f0bb678423fcea01ebe3b0edc74e6?d=identicon&s=25 Ben Johnson (benjohnson)
on 2008-11-25 10:43
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.
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2008-11-25 11:22
(Received via mailing list)
On Tue, Nov 25, 2008 at 10:38 AM, Ben Johnson <bjohnson@binarylogic.com>
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.
E9e97c333023338bcfc2789d48203ca8?d=identicon&s=25 David Dennis (mangala)
on 2008-12-02 07:59
Robert Dober wrote:
> On Tue, Nov 25, 2008 at 10:38 AM, Ben Johnson <bjohnson@binarylogic.com>
> 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 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.
Be07c8d0d6867fd9a0d525f7d17600e2?d=identicon&s=25 Damjan Rems (ther)
on 2008-12-02 08:37
David Dennis wrote:
> Robert Dober wrote:
>> On Tue, Nov 25, 2008 at 10:38 AM, Ben Johnson <bjohnson@binarylogic.com>
>> 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 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
E9e97c333023338bcfc2789d48203ca8?d=identicon&s=25 David Dennis (mangala)
on 2008-12-02 09:15
>
> 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
621080472679266b8e9b81aff4800398?d=identicon&s=25 Saji N. Hameed (Guest)
on 2008-12-02 09:38
(Received via mailing list)
* Damjan Rems <d_rems@yahoo.com> [2008-12-02 16:31:25 +0900]:

> 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      saji@apcc21.net
KOREA
703fbc991fd63e0e1db54dca9ea31b53?d=identicon&s=25 Robert Dober (Guest)
on 2008-12-02 10:27
(Received via mailing list)
On Tue, Dec 2, 2008 at 7:53 AM, David Dennis <college914@gmail.com>
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 Dober ;)
E9e97c333023338bcfc2789d48203ca8?d=identicon&s=25 David Dennis (mangala)
on 2008-12-02 17:27
Robert Dober wrote:
> On Tue, Dec 2, 2008 at 7:53 AM, David Dennis <college914@gmail.com>
> 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 Dober ;)

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

Thanks, David
E9e97c333023338bcfc2789d48203ca8?d=identicon&s=25 David Dennis (mangala)
on 2008-12-02 19:03
>
> 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.
E9e97c333023338bcfc2789d48203ca8?d=identicon&s=25 David Dennis (mangala)
on 2008-12-02 19:21
David Dennis 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
This topic is locked and can not be replied to.