2
votes

I'm getting an error when I try to do a git push to heroku (git push heroku master). I am on cedar stack and my Gemfile specifies sqlite 1.3.5. Here is the error:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
   /usr/local/bin/ruby extconf.rb
   checking for sqlite3.h... no
   sqlite3.h is missing. Try 'port install sqlite3 +universal'
   or 'yum install sqlite-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/local/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
   --enable-local
   --disable-local
   Gem files will remain installed in /tmp/build_3umr292rjcdek/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
   Results logged to /tmp/build_3umr292rjcdek/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
   An error occured while installing sqlite3 (1.3.5), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.

! ! Failed to install gems via Bundler. ! ! Heroku push rejected, failed to compile Ruby/rails app

4
Look at your database.yml. Might be the problem.Justin D.

4 Answers

8
votes

Heroku is telling you that you can't compile the sqlite3-ruby gem on the Heroku platform.

You might want to move the sqlite3-ruby gem into a group that isn't installed by default on Heroku.

gem "rails"

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end

group :production do
  gem "pg"
end

Update: It appears the gem sqlite3-ruby is old and the sqlite3 is the new gem you should use instead.

5
votes

One problem I had which caused hours of headaches was with the 'taps' gem. It was causing pretty much the exact same error for me until I moved it into the 'development' group:

group :production do 
  gem 'taps'
  gem 'pg'
end

Not sure if this is directly applicable to you, but it produced sqlite3 errors until I put taps into :production. Hopefully it'll help someone.

EDIT: @cloneofsnake: I don't have enough rep to comment on your answer, but I see you have the 'taps' gem in your Gemfile. Either get rid of it, or put it in the :production group; taps has some dependencies on sqlite3 apparently. I had already switched out sqlite3 for pg, but I was getting the same error as you until I moved 'taps' to production.

4
votes

Take a look which branch you are trying to push. In my case I was working on dev branch, and trying to push using:

$ git push heroku master

What git does is pushing my master branch to heroku but my master branch was using sqlite3, causing this weird error.

Try do do:

$ git push heroku [name_of_your_branch]:master
0
votes

Make sure you have the necessary gems in production. I recently had this problem myself. Also try using gem 'pg' (POSTGRESQL) instead of sqlite as thats what Heroku uses.

eg:

group :production do
  gem 'pg'
  gem 'carrierwave'
  gem 'rmagick'
  gem 'heroku'
  gem 'git-rails'
  gem "jquery-rails"
  gem 'hoe', '~> 1.5.1'
  gem "RedCloth"
  gem 'i18n'
end