Chachi
Chachi

Reputation: 63

Cannot install sqlite3 gem on Amazon Linux (development libraries for ruby and sqlite already installed)

I'm running an instance built off ami-595a0a1c which is Amazon's customized Linux. I am trying to install the sqlite3 (or sqlite) gem and it's failing with the below error:

$ sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path

(the location where your sqlite3 shared library is located). extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection. Results logged to /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out

Typically, this just means you need to install the development libraries and everything is cool. However, I have installed the sqlite-devel packages and still no dice. Since this is the Amazon Linux instance, I'd rather not add more repositories than the ones Amazon provides if possible. What can i do to get this thing to compile? Thanks for any insight!

From a brand new instance, here's what I've done:

$ sudo yum install rubygems ruby-devel

$ sudo gem update --system

$ sudo gem install rails

$ rails new app

$ cd app

$ rails server

Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.

$ sudo yum install sqlite-devel

$ sudo gem install sqlite (or sqlite3 -- same result)

See breakage above. And note - I do realize I can comment out the line in the gemfile to get rails to run but I actually need the gem. Thanks in advance!

Upvotes: 3

Views: 3023

Answers (2)

David Brush
David Brush

Reputation: 21

Ran into this as well. Surprisingly the stock amazon linux doesn't have make or gcc installed.

sudo yum install gcc
sudo yum install make

Upvotes: 2

Dmytrii Nagirniak
Dmytrii Nagirniak

Reputation: 24108

 $ sudo yum install libsqlite3-dev

Note the version 3.

Or if the package is available in your OS install libsqlite3-ruby

Upvotes: 0

Related Questions