sqlite3 – Sheep Guarding Llama https://sheepguardingllama.com Scott Alan Miller :: A Life Online Sat, 26 Sep 2009 14:01:44 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.1 Installing ruby-sqlite3 on Red Hat or CentOS Linux https://sheepguardingllama.com/2008/11/installing-ruby-sqlite3-on-red-hat-or-centos-linux/ https://sheepguardingllama.com/2008/11/installing-ruby-sqlite3-on-red-hat-or-centos-linux/#comments Sun, 23 Nov 2008 22:04:22 +0000 http://www.sheepguardingllama.com/?p=3012 Continue reading "Installing ruby-sqlite3 on Red Hat or CentOS Linux"

]]>
For my development environment, I like to SQLite3 on Red Hat Enterprise Linux (RHEL / CentOS.)  When working with the gem installer for the sqlite-ruby package I kept getting an error on my newest machine.  I searched online and found no answers anywhere while finding many people having this save problem.  I have found a solution.  There is no need to compile Ruby again from source.

The command used was:

gem install sqlite3-ruby

What I found was the following error:

gem install sqlite3-ruby
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… no
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/lib64/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

There are two main causes of this problem.  The first is that the correct dev packages are not installed.  Be sure that you install the correct packages for Red Hat.  In RHEL 5, which I use, SQLite3 is now simply SQLite.

yum install ruby-devel sqlite sqlite-devel ruby-rdoc

If you are still receiving the error then you most likely do not have a C compiler installed.  The Gem system needs make and the GCC.  So install those as well.  (Obviously you could combine these two steps.)

yum install make gcc

Voila, you SQLite / SQLite3 installation on Red Hat (RHEL), Fedora, or CentOS Linux should be working fine.  Now your “rake db:migrate” should be working.

Update: If you follow these direction and get the error that sqlite3-ruby requires Ruby version > 1.8.5 then you can go to my follow-up directions on
SQLite3-Ruby Gem Version Issues on Red Hat Linux and CentOS

]]>
https://sheepguardingllama.com/2008/11/installing-ruby-sqlite3-on-red-hat-or-centos-linux/feed/ 16