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
that fixed it. thanks!
+1 (plus it also fixed that on 9.04)
Thanks!
Yeah… sqlite3 sounds good now. Thank you!!
Thanks–I was having the same problem, and this seems to have fixed it!
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
Thx!
Still relevant for Ubuntu 10.04. Thanks!
+1. Thanks.
Is this still relevant? There’s a package in apt now for this ruby gem.
sudo apt-get install libsqlite3-ruby ?
Thanks a lot … still relevant for Ubuntu 11.