1

I'm working on a Ruby on Rails application with sqlite3 and when I run bundle install, I have this error:

Installing sqlite3 1.3.11 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/gems/sqlite3-1.3.11/ext/sqlite3/usr/bin/ruby1.9.1 -r ./siteconf20160411-6894-cji211.rb extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
    from extconf.rb:3:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/gems/sqlite3-1.3.11 for inspection.
Results logged to /tmp/bundler20160411-6894-186xx7csqlite3-1.3.11/extensions/x86_64-linux/1.9.1/sqlite3-1.3.11/gem_make.out
Using erubis 2.6.6
Using activemodel 3.0.5
Using rack-mount 0.6.14
Using rack-test 0.5.7
Using treetop 1.4.15
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.

Gemfile

source 'http://rubygems.org'

gem 'rails', '3.0.5'

gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'

Any ideas how I can fix this?

jdgray
  • 1,863
  • 1
  • 11
  • 19
girly49
  • 57
  • 5

2 Answers2

3

You need to install sqlite3 first sudo apt-get install libsqlite3-dev

Stevan O.
  • 161
  • 1
  • 8
0

Have you tried googling your error?

Here's an answer to the same error you're getting.

Unable to install gem - Failed to build gem native extension - cannot load such file -- mkmf (LoadError)

The solution is not with sqlite3. It's most likely your -dev package. If you're on Linux try this -

sudo apt-get install ruby-dev

For Mac, try this

brew install ruby-dev
Community
  • 1
  • 1
Julian Guterman
  • 177
  • 1
  • 6