Bundle Install will not complete on new Rails app after Mavericks upgrade - ruby-on-rails

My near term goal is to continue running some tutorials from RailsApp. I had previously had no issues running rails and writing apps and doing some older tutorials. A new one came out that used a template file for thee startup app. I needed to upgrade my ruby & rails versions for this, but it still would not work (question here: Error with RailsApps starter app for rails-devise-roles tutorial) so I went ahead and upgraded mavericks.
My question is how can I get the rails to create a new app and run ? i can't develop anything now. I don't know how ot revert to older versions of ruby (maybe one that does not use sqlite3?) [<
I have googled & stack overflow searched similar problems and none of the solutions seem to work for me so far.
Basic info:
$which ruby
/Users/suzanne/.rvm/rubies/ruby-2.1.2/bin/ruby
$ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
I have also opened XCode, updated libraries requested after opening. Version listed on splash page is Version 5.1.1 (5B1008)
Now I have done the following steps to test rails and get a basic new app working
mkdir myapp
cd myapp
rvm use ruby-2.1.2#myapp --ruby-version --create
gem install rails
rails new .
and at this point I get this error:
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
XCode is installed, gcc is installed, sqlite3 is installed.
$ whereis sqlite3
/usr/bin/sqlite3
$bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.5
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.5
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.5
Using activemodel 4.1.5
Using arel 5.0.1.20140414130214
Using activerecord 4.1.5
Using bundler 1.7.2
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.5
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.2
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.1.5
Using rdoc 4.1.1
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/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.
$ gem install sqlite3 -v '1.3.9'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/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/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9/gem_make.out

There was a change in Mavericks that means you have to install the command line tools.
Type in a terminal window
xcode-select --install
You should then be prompted to install the command line tools
Once that is done, you should be able to build your gems

Try gem install sqlite3 -- --with-sqlite3-dir=/opt/local and then run bundle install again.
If that doesn't work, I think you just need to install sqlite3. If you have Homebrew, this should work:
brew install sqlite3

Had the same problem running Rails 4.1.5 on CentOS 6.5.
I fixed it by:
Installing the sqlite dev library (On CentOS it's $ yum install -y sqlite-devel); and
Installing the sqlite3 gem with gem install sqlite3.
I was able to create a new rails project afterward.

Related

Gem::Ext::BuildError: ERROR: Failed to build gem native extension on mac. unable to install racc

Installing racc 1.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/racc-1.5.2/ext/racc/cparse
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210323-1013-1j708gz.rb extconf.rb
checking for rb_ary_subseq()... *** 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/2.6/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
from/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in`mktmpdir'
from/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in`try_link0'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in`try_link'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:782:in`try_func'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1069:in`block in have_func'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in`block in checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in`block (2 levels) in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in`block in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in`postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in`checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1068:in`have_func'
from extconf.rb:6:in `'
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/racc-1.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/racc-1.5.2 for
inspection.
Results logged to
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/racc-1.5.2/gem_make.out
An error occurred while installing racc (1.5.2), and Bundler cannot continue.
Make sure that gem install racc -v '1.5.2' --source 'https://rubygems.org/'succeeds before bundling.
In Gemfile:
rails was resolved to 6.1.3, which depends on
actioncable was resolved to 6.1.3, which depends on
actionpack was resolved to 6.1.3, which depends on
actionview was resolved to 6.1.3, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri was resolved to 1.11.2, which depends on
racc
The gem racc has the following dependencies:
* Ruby 1.8.x or later.
(*) make and C compiler.
See: Gem documentation
So my guess is that either one of those are not correctly installed on your machine.
Does ruby -v work?
Does make -v work?
Does gcc -v work?
To install ruby, you might want to look into rbenv (https://github.com/rbenv/rbenv)
To install make and gcc, simply run:
xcode-select --install

Error while running bundle install rails 5.2 app

OS: Mac Mojave 10.14.6
Rails 5.2.3
Ruby 2.6.3
I generated a new application, and was trying to do a
bundle install
Which was interrupted with the following error message:
Fetching nio4r 2.5.2
Installing nio4r 2.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2/ext/nio4r
/Users/johndoe/.rbenv/versions/2.6.3/bin/ruby -I /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20190924-11373-sf54p6.rb extconf.rb --with-cflags\=-std\=c99
checking for unistd.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/johndoe/.rbenv/versions/2.6.3/bin/$(RUBY_BASE_NAME)
/Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:601:in `try_cpp'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:14:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nio4r-2.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2 for inspection.
Results logged to /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nio4r-2.5.2/gem_make.out
An error occurred while installing nio4r (2.5.2), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 5.2.3, which depends on
actioncable was resolved to 5.2.3, which depends on
nio4r
I looked around, and tried some of the suggestions, such as
bundle config build.nio4r --with-cflags="-std=c99"
bundle
But it did not work. Any ideas?
EDIT:
This had been working fine, with my existing project, but it noticed that it stopped working yesterday, when I did a:
bundle update
I got the same error. If I do:
bundle install
when I add a new Gem to my existing project, it works fine. In my Gemfile.lock file, I have:
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
and:
nio4r (2.5.1)
By looking at it, it looks like you are missing tools to compile the gems. I'm not a OS-X user, but in linux distros this would be solved by installing the package build-essentials.
I did a quick research online and found out that in OS-X this tools are packaged in xcode, so I would recommend that you tried this command: xcode-select --install
Keep me posted if this fixed your issue.
Run xcode-select --install solved the issue. Thanks #luiz

Rmagick can't continue.I can't get this gem working on Windows

I am a beginner rails developer.I am trying to install Rmagick but i got these errors.On windows.
Installing rmagick 2.15.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.15.4/ext/RMagick
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160709-7156-1eqm5da.rb 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=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:110:in ``': No such file or directory - identify -version (Errno::ENOENT)
from extconf.rb:110:in `configure_compile_options'
from extconf.rb:16:in `initialize'
from extconf.rb:517:in `new'
from extconf.rb:517:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.15.4 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.15.4/gem_make.out
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using warden 1.2.6
Using mime-types 3.1
Using autoprefixer-rails 6.3.6.2
Using uglifier 3.0.0
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using sprockets 3.6.2
Using haml 4.0.7
An error occurred while installing rmagick (2.15.4), and Bundler cannot
continue.
Make sure that `gem install rmagick -v '2.15.4'` succeeds before bundling.
In case you migth ask, i have imagemagick installed and i clicked the add the path option.What should i do?

Cannot bundle install after cloning

I've been having problems running bundle install on my console every time I clone a project. But I face no problems running bundle install if I make my own project.
Anyone know what's up?
Fetching gem metadata from http://rubygems.org/
Fetching version metadata from http://rubygems.org/
Fetching dependency metadata from http://rubygems.org/
Resolving dependencies....
Using rake 11.2.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using coderay 1.1.1
Using debug_inspector 0.0.2
Using bundler 1.12.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Installing sqlite3 1.3.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Applications/rubystack-2.2.5-3/ruby/bin/ruby -r ./siteconf20160708-85177-1q2ntd0.rb 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=/Applications/rubystack-2.2.5-3/ruby/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
/Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:1113:in `block in find_header'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:1112:in `find_header'
from extconf.rb:30:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-10/2.2.0-static/sqlite3-1.3.11/gem_make.out
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Applications/rubystack-2.2.5-3/ruby/bin/ruby -r ./siteconf20160708-85177-1kbeqyk.rb extconf.rb --with-opt-dir=/usr
Using pkg-config version 1.1.7
checking if the C compiler accepts -I/Applications/rubystack-2.2.5-3/common/include/ImageMagick -I/Applications/rubystack-2.2.5-3/common/include -I/Applications/rubystack-2.2.5-3/common/include/ImageMagick -I/Applications/rubystack-2.2.5-3/common/include -I/Applications/rubystack-2.2.5-3/sqlite/include -I/Applications/rubystack-2.2.5-3/varnish/include -I/Applications/rubystack-2.2.5-3/python/include -I/Applications/rubystack-2.2.5-3/mysql/include -I/Applications/rubystack-2.2.5-3/postgresql/include -I/Applications/rubystack-2.2.5-3/apache2/include -I/Applications/rubystack-2.2.5-3/subversion/include -I/Applications/rubystack-2.2.5-3/common/include -I/usr/include -m64... *** 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
--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=/Applications/rubystack-2.2.5-3/ruby/bin/$(RUBY_BASE_NAME)
--help
--clean
/Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:414:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-10/2.2.0-static/nokogiri-1.6.8/gem_make.out
Using rack-test 0.6.3
Using mime-types 3.1
Using better_errors 2.1.1
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using sprockets 3.6.3
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.
I'm trying to run a ruby project file uploaded on github, and I was able to successfully clone it and I know I'm supposed to install the gems before I'm able to execute rails s but every time I try to run bundle install it gives me this really long line of code^
However, whenever I make a project of my own using rails new ___ I'm able to execute bundle install properly, install the gems and execute rails s I don't understand why it isn't working for when I clone another project.
UPDATE:
When I try to run gem install sqlite3 -- --with-sqlite3-dir=/opt/local, here's what it gives me
Building native extensions with: '--with-sqlite3-dir=/opt/local -E'
This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.11/ext/sqlite3
/Applications/rubystack-2.2.5-3/ruby/bin/ruby -r ./siteconf20160709-86573-198qtg.rb extconf.rb --with-sqlite3-dir=/opt/local -E
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=/Applications/rubystack-2.2.5-3/ruby/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
/Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:1113:in `block in find_header'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /Applications/rubystack-2.2.5-3/ruby/lib/ruby/2.2.0/mkmf.rb:1112:in `find_header'
from extconf.rb:30:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-10/2.2.0-static/sqlite3-1.3.11/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.11 for inspection.
Results logged to /Applications/rubystack-2.2.5-3/ruby/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-10/2.2.0-static/sqlite3-1.3.11/gem_make.out
Check where your sqlite is installed to and run the following command (i assume /opt/local here)
gem install sqlite3 -- --with-sqlite3-dir=/opt/local
and run bundle install
When installing the sqlite3 gem, native extensions are failing. This meaning that you need a system library installed.
Run this:
sudo apt-get install sqlite3 on ubuntu
brew install sqlite3 on mac
not sure about windows.
This type of error "failed to build native extension" is fairly common when installing Ruby gems. You'll sometimes need to go through some hoops to install the native extensions. Often you'll get long errors which don't at first seem to provide much helpful information. Try and find a line in the error which says that there is a missing library, then search the internet for that line and determine what you need to install.
Also see the sqlite3-gem-fails-to-install question

Error: extconf failed, exit code 1 [Ruby on Rails]

got an error while trying to install devise gem. Added gem "devise", "~> 3.2.2" to my Gemlist and went into terminal to do the following:
Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for ruby/util.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=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
Am new to programming and Ruby on Rails so kindly assist. Thanks!
managed to solve this. I had upgraded to OS Mavericks recently and problem came up.
Have tried gem install bcrypt-ruby -v '3.1.2' in terminal but encountered same problem.
Thereafter, went to install Xcode on App Store as running Xcode-select --install in terminal failed as well (program can't be found).
Thus I chanced upon this thread and followed advice to run sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2 in terminal.
Thread: gem install pg doesn't work on OSX Lion
Thereafter I ran gem install bcrypt-ruby -v '3.1.2' and bundle install in terminal and all good for now. Hope this works. Actually I don't know what I am doing but hopefully it works. Can someone enlighten me what I am actually doing?
Ran into this issue after updating OS X Mavericks to 10.9.5 which also updates Xcode (Version 6.0.1 (6A317)).
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/e/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: /usr/bin/c++ (c++ version )
extconf failed, exit code 1
Gem files will remain installed in /Users/e/.rvm/gems/ruby-2.1.1/gems/libv8-3.16.14.7 for inspection.
Results logged to /Users/e/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/libv8-3.16.14.7/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
To resolve: Must accept and finalise install of Xcode in order for bundle update to complete.
After finalising install of Xcode, bundle update completed without issue.

Resources