11 Answers
11

The SQLite RubyGem isn't actually a *Ruby*Gem, it's a "*C*Gem", IOW it's written in C. This means it has to be compiled and linked to the Ruby interpreter when you install it and in order to do that it needs the C header files for the Ruby interpreter.

If you compile Ruby yourself, those header files will be installed automatically, however, in RedHat-ish systems, such header files are usually packaged in a seperate package, called <whatever>-dev. So, in this case you will need to install the ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well.

However, you might be better off just installing your Operating System's pre-packaged libsqlite3-ruby package, that way all the dependencies are automatically satisfied.

(Note: all package names pulled out of thin air, might be different on your system.)

Damn SO is cool, this is actually the right answer... I was lost trying to install the SqlLite and the problem was producing new error messages every minute. Now if the questioner would just mark this as the right answer, we'd be in business.
–
YarJan 22 '09 at 0:51

6

On Ubuntu I did apt-get install libsqlite3-ruby and it worked perfectly. As root, of course...
–
YarJan 22 '09 at 0:52

3

Or if you wanted to install the gem, you would need to apt-get install ruby-dev, just as Jorg says.
–
ShadowfirebirdFeb 5 '10 at 14:37

Do you have all the source code required to build sqlite3-ruby? Gem is trying to compile some C code and cannot find the headers. You can probably use a fedora rpm for sqlite3-ruby (I don't use fedora, but I'm sure one exists) if you prefer to forgo compiling. Personally for ruby stuff, I prefer to use gem rather than a distro's packaging system.

The fedora rpm for the mysql headers is something like 'mysql-dev', so the correct sqlite rpm is likely to be 'sqlite3-dev'
–
erikJan 7 '09 at 17:58

I'm using FreeBSD 7.1 right now, and I have the sqlite3-3.6.4 port installed, which provided everything that gem needed if I remember right. I'm trying to check out Rails 2.2.2 myself. Good luck Erik!
–
barneytronJan 7 '09 at 18:14

I'm not really familiar with Fedora, but in Ubuntu when you are installing packages you have apt-get, and you have to install the build-essentials which includes gcc and other compilation tools for C. I would say that could be your issue, and you make look into how that can be install either using RPM or apt-get on Fedora.

I fixed the problem on my OLPC (Fedora 9) by installing 'gcc' oddly enough. It seems like it should have been one of those dev packages, but no.

Also, regarding the other packages, the suffix is "-devel", not "-dev", so make sure you get those ending right: "ruby-devel", "sqlite-devel"...

Once you get that installed, if you get errors about your gems being too old "< 1.3.1" when you try to run various rails scripts, eg: script/server or script/console, google "upgrade_rubygems" to fix that problem...