OSX - sqlite3 gem error install via bundler - ruby-on-rails

I am using a Mac OSX - version 10.8.5., Xcode - version 5.1.1, and Ruby - version 2.1.1p76 and I am trying to upgrade to Rails 4, but I run into a sqlite3 gem issue when I run bundle install.
This is my gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3', '~> 1.3.9'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.3.0'
end
gem 'jquery-rails'
This is what happens when I run "bundle install":
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.3
Using tzinfo 0.3.39
Installing activesupport 4.0.0
Installing builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Installing actionpack 4.0.0
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Installing actionmailer 4.0.0
Installing activemodel 4.0.0
Installing activerecord-deprecated_finders 1.0.3
Installing arel 4.0.2
Installing activerecord 4.0.0
Using bundler 1.6.2
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using coffee-script 2.2.0
Using thor 0.19.1
Installing railties 4.0.0
Using coffee-rails 4.0.1
Using hike 1.2.3
Using jquery-rails 3.1.0
Using json 1.8.1
Using tilt 1.4.1
Using sprockets 2.11.0
Installing sprockets-rails 2.0.1
Installing rails 4.0.0
Using sass 3.2.19
Using sass-rails 4.0.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for sqlite3.h... *** 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=/Users/user/.rvm/rubies/ruby-2.1.1/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
/Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/user/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:35:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/user/.rvm/gems/ruby-2.1.1/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/sqlite3-1.3.9/gem_make.out
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.

Related

rails app wont deploy to heroku

I am trying to push my app to heroku but i keep getting errors. I see that heroku doesnt support sqlite3 and I removed it from the gem file, then bundled. My database.yml file is using postgresql. Maybe something else is trying to use sqlite? How do I fix this issue? Below is the log from heroku after the following command.
$git push heroku master
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.4
-----> Installing dependencies using bundler 1.11.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.8.0
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.5
Installing builder 3.2.2
Installing erubis 2.7.0
Installing mini_portile 0.6.2
Installing rack 1.6.4
Installing arel 6.0.3
Installing coffee-script-source 1.9.1.1
Installing mime-types 2.6.1
Installing thor 0.19.1
Installing execjs 2.6.0
Using bundler 1.11.2
Using rdoc 4.2.0
Installing multi_json 1.11.2
Installing tilt 1.4.1
Installing sass 3.4.18
Installing sqlite3 1.3.10 with native extensions
Installing tzinfo 1.2.2
Installing nokogiri 1.6.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20161013-219-al82rl.rb 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).
*** 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=/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.10/gem_make.out
Installing rack-test 0.6.3
Installing sprockets 3.3.3
Installing mail 2.6.3
Installing coffee-script 2.4.1
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
Bundler Output: Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using rake 10.4.2
Installing i18n 0.7.0
Installing minitest 5.8.0
Installing json 1.8.3 with native extensions
Installing thread_safe 0.3.5
Installing builder 3.2.2
Installing erubis 2.7.0
Installing mini_portile 0.6.2
Installing rack 1.6.4
Installing arel 6.0.3
Installing coffee-script-source 1.9.1.1
Installing mime-types 2.6.1
Installing thor 0.19.1
Installing execjs 2.6.0
Using bundler 1.11.2
Using rdoc 4.2.0
Installing multi_json 1.11.2
Installing tilt 1.4.1
Installing sass 3.4.18
Installing sqlite3 1.3.10 with native extensions
Installing tzinfo 1.2.2
Installing nokogiri 1.6.6.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20161013-219-al82rl.rb 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).
*** 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=/tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.10 for inspection.
Results logged to /tmp/build_c19da7ca03c7dd80010af978d40d9316/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.10/gem_make.out
Installing rack-test 0.6.3
Installing sprockets 3.3.3
Installing mail 2.6.3
Installing coffee-script 2.4.1
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app.
! Push failed
Here is my database.yml file
development:
adapter: postgresql
encoding: utf8
database: db/development
host: localhost
pool: 5
timeout: 5000
username: sfinley
password: password
test:
adapter: postgresql
encoding: utf8
database: db/test
pool: 5
timeout: 5000
username: sfinley
password: password
production:
adapter: postgresql
encoding: utf8
database: db/production
pool: 5
timeout: 5000
username: sfinley
password: password
Here is my gem file
source 'https://rubygems.org'
# http://ifyouseeit.org/blog/2013/08/07/switch-db-from-sqlite3-to-postgres-in-rails-app/
gem 'pg'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
I have answered this question before in a similar post. Doing a simple search would have gotten you the answer instead of asking right away. Anyways heres the solution.
Just do this in your Gemfile
group :production do
gem 'pg'
gem 'rails_12factor'
end
and shift your sqlite3 gem to
group :development, :test do
gem 'sqlite3'
end
run bundle install --without production and you should be good to go. Remember to push your new code to git before trying to push to Heroku.

Errors of pushing rails app to Heroku error occurred while installing sqlite3, and Bundler cannot continue [duplicate]

This question already has answers here:
Deploying RoR app to Heroku with SQLite 3 fails
(7 answers)
Closed 7 years ago.
I was trying to push my rails app to heroku and received errors as below:
-
Counting objects: 177, done. Delta compression using up to 2 threads.
Compressing objects: 100% (161/161), done. Writing objects: 100%
(177/177), 44.73 KiB, done. Total 177 (delta 39), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.1
Running: bundle install --without development:test --path vendor/bundle -
-binstubs bin/
Fetching gem metadata from
Fetching gem metadata from
Installing rake (10.0.2)
Installing i18n (0.6.1)
Installing multi_json (1.3.7)
Installing activesupport (3.2.8)
Installing builder (3.0.4)
Installing activemodel (3.2.8)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.1)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.1.3)
Installing actionpack (3.2.8)
Installing mime-types (1.19)
Installing polyglot (0.3.3)
Installing treetop (1.4.12)
Installing mail (2.4.4)
Installing actionmailer (3.2.8)
Installing arel (3.0.2)
Installing tzinfo (0.3.35)
Installing activerecord (3.2.8)
Installing activeresource (3.2.8)
Using bundler (1.2.1)
Installing coffee-script-source (1.4.0)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.7.5) with native extensions
Installing rdoc (3.12)
Installing thor (0.16.0)
Installing railties (3.2.8)
Installing coffee-rails (3.2.2)
Installing jquery-rails (2.1.3)
Installing rails (3.2.8)
Installing sass (3.2.3)
Installing sass-rails (3.2.5)
Installing sqlite3 (1.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native ex tension.
/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_2pense1pvyqut/vendor/bundle /ruby/1.9.1/gems/sqlite3-1.3.6
for inspection.
Results logged to /tmp/build_2pense1pvyqut/vendor/bundle/ruby/1.9.1/gems/
sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot co ntinue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
! ! Failed to install gems via Bundler. ! ! Heroku push
rejected, failed to compile Ruby/rails app
=========================================
My GemFile as below:
=======================================
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do gem 'pg' end
group :development, :test do gem 'taps' gem 'rvm'
gem 'rspec-rails','2.0.1' gem 'annotate' gem 'faker','0.3.1' gem 'rspec','2.0.1' gem 'webrat','0.7.1' gem 'spork','0.8.4'
gem 'factory_girl_rails','1.0' end
gem 'rake', '~> 10.0.1'
#gem 'yaml_db'
# Gems used only for assets and not required
# in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more
supported runtimes # gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3' end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
=======================================
I tried almost all the solutions provided online, but still no luck.
Any help will be greatly appreciated.
I don't see it in your code above, but guessing you probably have your gem 'sqlite3' at the top of your gemfile, so it is being used in all environments. Sqlite is not supported on Heroku so it has be kept out of the production group. Try the following so that you can use sqlite for development and testing and then pg on Heroku.
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Had the same issue. Realized that I hadn't committed my changes to Git. Once I committed it and re-pushed it to Heroku, it worked without issue.
The following worked for me on my Mac:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
And then
bundle install
but that threw up this error:
can't find the 'libpq-fe.h header *** extconf.rb failed ***
Solved this error using Homebrew as explained here - https://stackoverflow.com/a/20482221/2665896
i.e.
brew install postgresql
gem install pg
Then commit the Gemfile and Gemfile.lock to the local master.
Then git push heroku master worked like a charm.

Regarding my app update on Heroku

Results logged to /tmp/build_207lfem2op1z3/vendor/bundle/ruby/1.9.1/gems/linecache19-0.5.12/ext/trace_nums/gem_make.out
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:intense-garden-9145.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:intense-garden-9145.git'
So please help me in solving this Iam new to Heroku and Ruby on rails
I have followed the following steps to update my app
git init
git add.
git commit -m '.'
git push heroku master
And I have got the following run error
saasbook#saasbook:~/hw2_rottenpotatoes$ git push heroku master
Counting objects: 462, done.
Compressing objects: 100% (240/240), done.
Writing objects: 100% (462/462), 76.71 KiB, done.
Total 462 (delta 185), reused 427 (delta 172)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.1
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Installing rake (0.9.2.2)
Installing multi_json (1.0.4)
Installing activesupport (3.1.0)
Installing bcrypt-ruby (3.0.1) with native extensions
Installing builder (3.0.0)
Installing i18n (0.6.0)
Installing activemodel (3.1.0)
Installing erubis (2.7.0)
Installing rack (1.3.6)
Installing rack-cache (1.0.3)
Installing rack-mount (0.8.3)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.0.3)
Installing actionpack (3.1.0)
Installing mime-types (1.17.2)
Installing polyglot (0.3.3)
Installing treetop (1.4.10)
Installing mail (2.3.0)
Installing actionmailer (3.1.0)
Installing arel (2.2.1)
Installing tzinfo (0.3.31)
Installing activerecord (3.1.0)
Installing activeresource (3.1.0)
Installing archive-tar-minitar (0.5.2)
Installing coffee-script-source (1.2.0)
Installing execjs (1.2.13)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.6.5) with native extensions
Installing rdoc (3.12)
Installing thor (0.14.6)
Installing railties (3.1.0)
Installing coffee-rails (3.1.1)
Installing columnize (0.3.6)
Installing haml (3.1.4)
Installing jquery-rails (1.0.19)
Installing libv8 (3.3.10.4)
Installing ruby_core_source (0.1.5)
Installing linecache19 (0.5.12) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
*** 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-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
/usr/local/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': Read-only file system - /usr/local/include/ruby-1.9.1/ruby-1.9.2-p290 (Errno::EROFS)
from /usr/local/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir'
from /usr/local/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p'
from /usr/local/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each'
from /usr/local/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p'
from /usr/local/lib/ruby/1.9.1/fileutils.rb:201:in `each'
from /usr/local/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p'
from /tmp/build_lt34ecl4ewpm/vendor/bundle/ruby/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:59:in `block in create_makefile_with_core'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:320:in `open'
from /tmp/build_lt34ecl4ewpm/vendor/bundle/ruby/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:51:in `create_makefile_with_core'
from extconf.rb:19:in `<main>'
Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz
Gem files will remain installed in /tmp/build_lt34ecl4ewpm/vendor/bundle/ruby/1.9.1/gems/linecache19-0.5.12 for inspection.
Results logged to /tmp/build_lt34ecl4ewpm/vendor/bundle/ruby/1.9.1/gems/linecache19-0.5.12/ext/trace_nums/gem_make.out
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git#heroku.com:intense-garden-9145.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:intense-garden-9145.git'
Below Iam posting my Gem file
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'therubyracer'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
gem 'ruby-debug19', :require => 'ruby-debug'
gem 'haml'
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
Typically you will only have ruby-debug gem in use in development, not in production. Make sure ruby-debug is in the :development or :test group in your Gemfile.
group :development, :test do
gem 'ruby-debug19', :require => 'ruby-debug'
end
Then try the following
Run bundle again
Commit your Gemfile and Gemfile.lock
Push to Heroku again
linecache19 is installed as a dependency of ruby-debug19, which you don't want to have in production anyway.
In your Gemfile, replace the line that says
gem 'ruby-debug19', :require => 'ruby-debug'
with this
group :development, :test do
gem 'ruby-debug19', require: 'ruby-debug'
end
which will mean that the debugger is only loaded in the development and test environments.
You're also going to run into trouble with sqlite3 which is not supported on Heroku either... see this question

Stuff-Classifier Gem with heroku

im trying to deploy my ruby code to heroku
this is my Gemfile ,
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'googlecharts'
gem 'stuff-classifier'
gem 'devise'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem "pg"
end
group :development, :test do
gem "sqlite3"
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
and im getting this on push
HengHongs-MacBook-Pro:collab Kinnovate$ git push heroku master
Counting objects: 19, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (16/16), 1.44 KiB, done.
Total 16 (delta 11), reused 0 (delta 0)
-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
Using activemodel (3.2.6)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.6)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.6)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.6)
Using activeresource (3.2.6)
Using bcrypt-ruby (3.0.1)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.6)
Using coffee-rails (3.2.2)
Using orm_adapter (0.4.0)
Using warden (1.2.1)
Using devise (2.1.2)
Using fast-stemmer (1.0.1)
Using googlecharts (1.6.8)
Using jquery-rails (2.1.1)
Installing msgpack (0.4.7) with native extensions
Using pg (0.14.0)
Using bundler (1.2.0)
Using rails (3.2.6)
Using sass (3.2.1)
Using sass-rails (3.2.5)
Installing sequel (3.20.0)
Installing sqlite3 (1.3.6) with native extensions
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_2wrfyq245cb6w/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /tmp/build_2wrfyq245cb6w/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
!
! Heroku push rejected, failed to compile Ruby/rails app
it works fine when i remove stuff-classifier gem from the Gemfile
how do i fix this?
forked the repo and removed sqlite dependancy from gemspec file
added this to gemfile
gem 'stuff-classifier' , :git =>'https://github.com/henghonglee/stuff-classifier'

After Xcode 4.4 and OSX 10.8 Installation - 'Failed to build gem native extension' when installing libv8

I've recently upgraded OSX to Mountain Lion (10.8) and Xcode (4.4) and ran into issues when trying to get my rails environment working. I started with running bundle install and ran into an error when installing the libv8 library. Below is a paste of the full error. I've search around and looked for similar issues, but what I found on stackoverflow so far has not applied to my problem. Here are the few things I've tried so far with no avail:
install Xcode Command Line Tools
install MySQL
install X11
install different versions of libv8 via the gemfile
Now I'm at a point where the problem seems to be exceeding my ruby skills. If anyone has some ideas on what I can try or are experiencing a similar issue, I'd love your help. Thanks!
Here's what my gemfile looks like:
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'bundler'
gem 'rake'
gem 'sqlite3'
gem 'haml'
gem 'nokogiri'
gem 'whenever'
gem 'mysql'
gem 'mysql2'
gem 'jquery-rails'
gem 'capistrano'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
And here's the error log when trying to install gems:
sudo bundle install
Password:
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
Using activemodel (3.2.6)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.6)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.6)
Using arel (3.0.2)
Using tzinfo (0.3.33)
Using activerecord (3.2.6)
Using activeresource (3.2.6)
Using bundler (1.0.15)
Using highline (1.6.13)
Using net-ssh (2.5.2)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.12.0)
Using chronic (0.6.7)
Using coffee-script-source (1.3.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.3)
Using rdoc (3.12)
Using thor (0.15.4)
Using railties (3.2.6)
Using coffee-rails (3.2.2)
Using haml (3.1.6)
Using jquery-rails (2.0.2)
Installing libv8 (3.3.10.4) with native extensions /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:482:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/libv8-3.3.10.4 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/libv8-3.3.10.4/ext/libv8/gem_make.out
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:445:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:445:in `build_extensions'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:197:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:49:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/cli.rb:222:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Try to add
gem 'therubyracer', '0.11.0beta5'
gem 'libv8', '~> 3.11.8'
to your Gemfile. It helps for me.
This is a quick guide on how to get rails running on 10.8: http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion
From the guide:
If you need to install any Ruby that’s older than 1.9.3, such as 1.9.2, 1.8.7 or REE, you’ll need to install GCC 4.2.
Okay, after some digging and seeing I'm not the only one with the problem, I've found the solution. Ultimately, it was because the 'therubyracer' gem was referencing a version of libv8 that was't compiling on Mountain Lion. The fix was to update the gem to use a beta version of the gem which uses an more recent version of libv8. Here's a link to the issue on github: https://github.com/cowboyd/therubyracer/issues/181
I kept a list of crib notes of the entire process of getting rails back up and running, and here a short list of it for anyone it might help.
Uninstall and Reinstall Brew (it wouldn't update to 0.9 with brew update, so a manual reinstall was needed)
Install GCC Compiler that is no longer included as mentioned by #Joe
- chown the /Library/Caches directory
Install MySQL
Install X11
Update Gemfile to use beta version of 'therubyracer'
gem "therubyracer", "~> 0.11.0beta5"
Fix issues with Nokigiri and LibXML conflicts as covered here:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
bundle install and win!
I have a couple of suggestions. It might help to use rvm or rbenv rather than the system version of Ruby:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Another suggestion is to use the latest version of libv8 and the pre-release version of therubyracer which will compile against it.
Although it is not updated to latest build env. (Xcode 4.4), following this answer (on question: Issue updating Ruby on Mac with Xcode 4.3.1) might help.
While Xcode version is different, basic setup is same.
I'm trying to build env with Xcode 4.4 had minor issue with specific gem(capybara-webkit) at this moment. Will update the answer.

Resources