Home > Ruby development > install Sqlite3-ruby gem on ubuntu 8.10

install Sqlite3-ruby gem on ubuntu 8.10

When I tried to install the Ruby adapter for Sqlite3 on my Ubuntu dev box, I encountered this error:

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

/usr/bin/ruby1.8 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

After a look in some forums I found a solution. These are the steps needed to install the database and the adapter for Ruby 1.8.7

First I install the Sqlite3 database:
~$ sudo apt-get install sqlite3

After this we install the lib so we don’t get the error:
~$ sudo apt-get install libsqlite3-dev

Now we can install the gem without the error:
~$ sudo gem install sqlite3-ruby

Advertisements
Categories: Ruby development Tags: , ,
  1. Matt Webster
    March 25, 2009 at 7:54 pm

    that fixed it. thanks!

  2. June 9, 2009 at 6:48 pm

    +1 (plus it also fixed that on 9.04)

    Thanks!

  3. June 15, 2009 at 9:49 am

    Yeah… sqlite3 sounds good now. Thank you!!

  4. Flioto
    August 13, 2009 at 1:29 pm

    Thanks–I was having the same problem, and this seems to have fixed it!

  5. chamira
    December 4, 2009 at 7:38 am

    Thanks, this is still relevant to Ubuntu 9.10

    I was getting an error:
    “..in `open’: uninitialized constant SQLite3::Driver::Native::Driver::API (NameError)”

    while trying to create/open a database using:
    $db = SQLite3::Database.new(“dbfile”)

    I had sqlite3 gem installed but did not have the libsqlite3-dev package. The book I was following – Beginning Ruby by Peter Cooper, 2nd Ed, Apress – did not mention this specifically.

    I thought I’d post an extended explanation as it may help others new to Ruby & sqlite.

    Cheers

  6. April 17, 2010 at 9:28 pm

    Thx!

  7. August 31, 2010 at 12:37 am

    Still relevant for Ubuntu 10.04. Thanks!

  8. Drew Wells
    March 2, 2011 at 4:16 pm

    Is this still relevant? There’s a package in apt now for this ruby gem.
    sudo apt-get install libsqlite3-ruby ?

  9. April 26, 2011 at 12:01 am

    Thanks a lot … still relevant for Ubuntu 11.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: