How do I fix bundle install error regarding nokogiri? - ruby-on-rails

I'm getting this error when I'm trying to bundle install an older project. I'm stuck and not sure how to fix this. I'm getting error on multiple projects. Is there a way to maintenance it? I've tried bundle update. Does anyone have any ideas? I upgraded to macOS Mojave 10.14.6. Thank you
Fetching nokogiri 1.10.4
Installing nokogiri 1.10.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/myname/.gem/ruby/2.5.1/gems/nokogiri-1.10.4/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20190822-3395-a2lga2.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... *** 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=/usr/local/Cellar/ruby/2.5.1/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:416:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/myname/.gem/ruby/2.5.1/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.10.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/myname/.gem/ruby/2.5.1/gems/nokogiri-1.10.4 for inspection.
Results logged to /Users/myname/.gem/ruby/2.5.1/extensions/x86_64-darwin-17/2.5.0/nokogiri-1.10.4/gem_make.out
An error occurred while installing nokogiri (1.10.4), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.4' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
recurring_select was resolved to 2.0.0, which depends on
rails was resolved to 5.0.7.2, which depends on
actioncable was resolved to 5.0.7.2, which depends on
actionpack was resolved to 5.0.7.2, which depends on
actionview was resolved to 5.0.7.2, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
Joshuas-iMac:momentum-master myname$
```git

Run these commands:
gem uninstall nokogiri
xcode-select --install
gem install nokogiri
source: http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
sometimes mac updates can break xcode CLI so reinstalling can fix the issue: https://github.com/sparklemotion/nokogiri/issues/1445
*
https://stackoverflow.com/a/37757604/11544569
*

Related

Canvas-lms in ubuntu 20.04 bundle install thrift error

I need to install canvas-lms stable/2018-12-08 in ubuntu 20.04
I have:
rbenv
ruby 2.4.0
bundler 1.16.4
I get this error:
Installing thrift 0.9.3.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thrift-0.9.3.0/ext /home/jxd/.rbenv/versions/2.4.0/bin/ruby -I /home/jxd/.rbenv/versions/2.4.0/lib/ruby/site_ruby/2.4.0 -r ./siteconf20220417-4132-wc9kcv.rb extconf.rb checking for strlcpy() in string.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=/home/jxd/.rbenv/versions/2.4.0/bin/$(RUBY_BASE_NAME) /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:542:in `try_link0' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:557:in `try_link' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:768:in `try_func' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:1055:in `block in have_func' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:945:in `block in checking_for' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:347:in `postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:944:in `checking_for' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:1054:in `have_func' from extconf.rb:31:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/thrift-0.9.3.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thrift-0.9.3.0 for inspection. Results logged to /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/thrift-0.9.3.0/gem_make.out
An error occurred while installing thrift (0.9.3.0), and Bundler cannot continue. Make sure that `gem install thrift -v '0.9.3.0'
--source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile: event_stream was resolved to 0.0.1, which depends on
canvas_cassandra was resolved to 0.0.1, which depends on
cassandra-cql was resolved to 1.2.3, which depends on
thrift_client was resolved to 0.9.3, which depends on
thrift
I followed the directions found in the canvas-lms documentation
I tried:
~/canvas$ bundle config build.thrift --with-cppflags='-D_FORTIFY_SOURCE=0'
gem install thrift -v 0.8.0 -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
~/canvas$ bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
Not work
I switch to ruby 2.5.0 (upgrade) and bundler 1.13.3 (downgrade). It works for me.
I do not understand but it works.
update....
Does bundle config build.thrift
"--with-cppflags="-Wno-compound-token-split-by-macro"" && bundle
install work? – razvans
work but with ruby 2.5.0

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

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

Rails bundle install not working error with nokogiri

I started a new rails project, cd'd inside it and then tried to bundle install
I got the following error
An error occurred while installing nokogiri (1.6.7), and Bundler cannot
continue.
Make sure that gem install nokogiri -v '1.6.7' succeeds before bundling.
I am pretty sure this is a level A problem I tried googling it but found nothing, hope i didnt overlook it
Thanks for any help
edit: if i try to manually install nokogiri it gives the following error
Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokiogiri
ERROR: Could not find a valid gem 'nokiogiri' (>= 0) in any repository
ERROR: Possible alternatives: nokogiri, nokogirl, niceogiri, onigiri
Adams-MacBook-Pro:fancy_cars adamkatz$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/adamkatz/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151213-2420-12wvig2.rb extconf.rb
checking if the C compiler accepts ... *** 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/adamkatz/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
/Users/adamkatz/.rbenv/versions/2.2.3/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 /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `'
extconf failed, exit code 1
Gem files will remain installed in /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.7 for inspection.
Results logged to /Users/adamkatz/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.7/gem_make.out
You need to install the OS X development tools (the output says so, towards the end).
Here are some good instructions on installing xcode: Installing Ruby on Rails on Mac for Ruby on Rails development (about half way down)
If that works it looks like the simplest way to get you there.
If that doesn't work you might find help here:
http://tosbourn.com/nokogiri-wont-install-check-accepted-xcodes-eula/
SO: Installing Nokogiri on OS X 10.10 Yos

Resources