0

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

2 Answers2

0

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

Khanh Pham
  • 2,848
  • 2
  • 28
  • 36
0

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

Community
  • 1
  • 1
max pleaner
  • 26,189
  • 9
  • 66
  • 118