Why can't I install the SQLite gem?

I am trying to install a SQLite gem on a Fedora 9 Linux box with Ruby 1.8.6, Rails 2.2.2, gem 1.3, and sqlite-3.5.9. Here is the command I'm running and its results:

sudo 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 can't find header files for ruby. 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 

gem_make.out simply repeats what has already been sent to the console. How to install this stone?

+60
ruby ruby-on-rails sqlite gem
Jan 07 '09 at 17:30
source share
14 answers

SQLite RubyGem is actually not RubyGem, it is "CGem", IOW it is written in C. This means that it must be compiled and linked to the Ruby interpreter when it is installed, and for this, the C header files for the Ruby interpreter.

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

However, you might be better off just installing a package with the libsqlite3-ruby operating system package installed, so all dependencies will be automatically executed.

(Note: all package names taken out of thin air may differ on your system.)

+134
Jan 07 '09 at 18:04
source share

You probably need the ruby ​​dev package. For Ubuntu, you need to install ruby1.8-dev, which includes ruby ​​header files. A quick google says the yum package is ruby. so run this:

sudo yum install ruby-devel

+12
Jan 08 '09 at 2:55
source share

I encountered a problem installing sqlite3-ruby gem on my fedora 13 block. It was fixed after sudo yum install sqlite-devel

+9
Jan 6 2018-11-11T00:
source share

When I had this problem:

 gem install sqlite3 -v '1.3.9' Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension. 

For me, installing " libsqlite3-dev " worked with:

 apt-get install libsqlite3-dev 
+8
May 12 '16 at 12:33
source share
 sudo apt-get install ruby-dev 

Fixed it for me.

+6
Dec 18 '10 at
source share

On Ubuntu 9 and 10, try:

 sudo apt-get install ruby-dev sudo apt-get install sqlite3-dev 

Then run

 gem install sqlite3 
+3
Aug 23 2018-11-21T00:
source share

Complete the following for Fedora OS:

 yum install rubygem-sqlite3 
+2
Jul 20 2018-11-11T00:
source share

Do you have all the source code needed to build sqlite3-ruby? Gem is trying to compile C code and cannot find headers. You can probably use the rpm generator for sqlite3-ruby (I don't use Fedora, but I'm sure it exists) if you prefer to refuse compilation. Personally, for ruby ​​material, I prefer to use a gem rather than a distribution system.

+1
Jan 07 '09 at 17:44
source share

I'm not very familiar with Fedora, but in Ubuntu, when you install the packages, you have apt-get, and you need to install the components necessary for the assembly, which include gcc and other compilation tools for C. I would say that this is yours problem, and you see how it can be installed either using RPM or apt-get on Fedora.

0
Jan 07 '09 at 17:53
source share

I fixed the problem on my OLPC (Fedora 9) by installing "gcc" oddly enough. It looks like it was one of those dev packages, but no.

Also, for other packages, the suffix is ​​set to "-devel" and not "-dev", so make sure you get back to them: "ruby-devel", "sqlite-devel" ...

After you installed this, if you encounter errors that your gems were too old "<1.3.1" when trying to run various rail scripts, for example: script / server or script / console, google "upgrade_rubygems" to fix this problem ...

NTN ...

0
May 15, '09 at 21:48
source share

I had the exact same problem ... instead of copying the missing parts, I used the unbuntu synaptic method.

The key package for me was libsqlite-ruby1.9.1 ... I registered my experience (for reference) with this error at: Sqlite3-gem-error-during-bundle-install

0
Dec 21 '10 at 7:23
source share

Run "sudo yum install sqlite-devel" and then "gem install sqlite3". There was the same problem on my Fedora 15.

0
Aug 01 2018-11-11T00:
source share

On alpine you need to install the sqlite-dev package.

0
Feb 13 '18 at 9:45
source share

I encountered this error when running bundle install after generating the act-rails application in Fedora 29. I was able to determine the appropriate development package by running dnf search sqlite3 and then installing it dnf install libsqlite3x-devel . This fixed it for me.

0
Apr 15 '19 at 15:50
source share



All Articles