I have a rails 3.1 app that i am trying to push to Heroku. It keeps failing when i push it.
Installing sqlite3 (1.3.4) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/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).
I changed my gem file to have the following lines:
gem 'sqlite3', :group => [:development, :test]
gem 'pg', :group => [:production]
Even after running bundle install etc i am getting the error. I even ran some tests without sqlite3 in my gem file and it still tries to install it on Heroku. Any suggestions?
Lol it turns out i was working on one branch and was pushing my master. Once i merged them and pushed the correct branch everything worked great.
The Cedar stack doesn't yet support bundle without according to the docs, http://devcenter.heroku.com/articles/bundler so it will still attempt to install it on deployment.
To be honest, you'd be much better using postgres locally if that is what you're deploying too.
Related
Error installing sqlite3, failed to build native gem extension.
Running on Windows 10.
Following a codeacademy tutorial, I successfully installed Ruby on Rails (ruby version : 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32) (rails version : 5.1.7). Running 'bundle install' popped up with an error saying I needed to download SQlite.
No problem, I go to the SQLite website and download sqlite3. Re-running 'bundle install', I get an error saying :
'An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'
succeeds before bundling.'
Following the suggestion, I run this command and get the following error:
'sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. Could not create Makefile..'
I have download sqlite3 from the website, there is no sqlite3.h file in the folders. My google and SO searches have been fruitless.
Can you try the steps here:
https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b
Github thread - https://github.com/sparklemotion/sqlite3-ruby/issues/224#issuecomment-482612096
Go to Gemfile and replace gem'sqlite3' to gem 'sqlite3', '< 1.4'
I've seen multiple questions, all with the same problems as me. I tried all the solutions proposed, such as making the following my Gemfile
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Added, committed, and nothing. Still the same issue when I run git push heroku master:
em::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
tmp/build_d2c698fb-cf76-40cd-b046-9866c3432e8b/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
I tried installing Xcode to see if that solves it, but it didn't. Ran brew install sqlite3 which also didn't solve it.
I also checked the dependencies of my gems in my Gemfile, with gem dependency and also checking the Gemfile.lock file, which shows no dependencies for the sqlite3 gem.
I can't find a solution to this problem from existing questions. Maybe I skimmed over something I am missing, but I can't find it.
Some extra information:
$ rails -v
Rails 4.1.1
$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
$ gem -v
2.2.2
$ sqlite3 -version
3.7.13 2012-07-17
I've developing an app locally with sqlite but now want to move it to Heroku, so I will use postgres from now on. I don't need to keep the database as it is so far, I just need Heroku to not try to install Sqlite because it blows up like so:
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.
I have changed my database.yml file and switched 'gem' "sqlite3" to 'gem' "pg" in my Gemfile, but heroku is still mad. What else needs to change so it doesn't try to install sqlite3 when I commit my app?
Once you've changed your Gemfile to use gem 'pg' then you need to rerun the bundle command. Once you've done that, commit your Gemfile and Gemfile.lock to git and then push the application to Heroku and it should work.
If you don't run Postgres locally then you should add gem 'pg' to your production group in your Gemfile else when you run bundle locally you'll have issues when it tries to compile the gem. You could safely move gem 'sqlite' to a development group in your Gemfile to use different DBs between environments. But bewarned it's safest to run the same DB locally when as you are deploying to.
I had this app using 1.9.2 and rails 3.2
and today I changed the ruby version into 1.9.3 (using rbenv)
and everything went wrong then
I had this on my gemfile
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Everytime I run:
bundle install --without production
Nothing happens now and when I do
git push heroku master
I get the same error:
Installing sqlite3 (1.3.5) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/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:
Its obviously trying to install sqlite, but even if I remove the sqlite gem from my Gemfile nothing happens, seems that the problem is in heroku but now I can't do nothing
Hope someone can help me because I was trying to do
heroku db:pull
and because of that I wanted to add the taps gem, then I followed this tutorial
http://railsapps.github.com/rails-heroku-tutorial.html
And I changed the version of ruby in heroku, now I think that the problem is rbenv but I'm not sure
Thanks in advance
Javier Q
Actually in order to get all the db I only had to do:
gem install taps
and not to put it into the Gemfile because it requires sqlite3
When I run 'rails server' I get the following error:
Could not find gem 'sqlite3 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
My GemFile looks like this: gem 'sqlite3'
Also when I run the port command it says it does not recognize that command:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ port install sqlite3 +universal
-bash: port: command not found
Any suggestions?
UPDATE 1:
I run sudo gem install sqlite3 and got the following message:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 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.
UPDATE 2: (Contents of GemFile)
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
UPDATE 3:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ port search sqlite3
-bash: port: command not found
UPDATE 4:
After downloading the install Macports I ran the bundle install again and here is the result:
Installing sqlite3 (1.3.3) with native extensions /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:inbuild_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 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.
`
UPDATE 5:
which sqlite3 gives me the following:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ which sqlite3
/opt/local/bin/sqlite3
UPDATE 5:
which -a sqlite3 gives me the following:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ which -a sqlite3
/opt/local/bin/sqlite3
/usr/local/bin/sqlite3
/usr/bin/sqlite3
If you have problems talking about /usr/local/bin/ruby extconf.rb checking for sqlite3.h then it's probably something to do with macports.
First, make sure you have xcode installed. Run:
gcc
and you should get:
i686-apple-darwin10-gcc-4.2.1: no input files
If you do, then let's install homebrew
Then, a list of commands to install homebrew, update rubygems, and upgrade rails
brew install sqlite
gem update --system
gem install bundler
gem install rails -v=3.0.8
Then, to check, rails -v should output Rails 3.0.7
If you are running 10.4 or earlier you don't have sqlite 3 (the actual DB engine, not the gem) installed by default. You have 3 options (assuming upgrading your OS to 10.5 or 10.6 is not an option):
Compile the source (not as bad as it sounds) http://www.sqlite.org/download.html
Install MacPorts (why the port command was not found) http://www.macports.org/install.php
Don't use sqlite. Instead use mysql or another DB of your choice.
I recommend the latter if you are going to deploy using some DB other than sqlite, and deploying with sqlite generally isn't a good idea. I like to keep my development and production environments fairly uniform to help avoid gotchas and such.
I hope this helps.
I'm summing up in a reply. So :
1) Install macports : http://www.macports.org/install.php - It has a dmg installer, will take 2 minutes.
2) Once you have it installed, do a 'bundle install' and sqlite3 will be installed as specified in your Gemfile.
When you use port look for a package called sqlite3-dev or something similar to that. The -dev part is key. I don't use MacPorts, but on my Ubuntu install this is the needed package.
When you want to install a package that you plan to link against, always look for the -dev version. The -dev means that it installs the header files among other things that are needed for development against that package.
Most likely your gem cannot build the sqlite3 native extension because it is looking for the header files, if this does not solve your problem please post the log file for the gem installation.
From your Rails directory:
cd ..
cd rails-root
ruby -v
gem list sqlite3
bundle install
gem list sqlite3
bundle exec rails server
What might be happening is you're bundling in a Rails app that has an .rvmrc file. I've seen cases where you bundle under a version of Ruby that doesn't match the .rvmrc file or some other mismatch so when you bundle sqlite3 it isn't under the same version of Ruby that rails is using when you run the app.
Changing out of the directory and back into it, and running rails server prefixed with bundle exec are my two suggestions.
there were several links about your problem :
Install sqlite3 on mac osx?
Snow Leopard & Ruby on Rails - SQLite3 issue
http://railsforum.com/viewtopic.php?id=23018