1

I am trying to run a bundle install, but when I do, I am getting an error message that says, "An error occurred while installing sqlite3 (1.3.13), and Bundler cannot continue." I tried running gem install sqlite3 -v '1.3.13', but am getting an error with that as well.

Here is my Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.1'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# 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', platforms: [:mri, :mingw, :x64_mingw]
  # Use sqlite3 as the database for Active Record
    gem 'sqlite3'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :production do 
    gem 'pg' 
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'jquery-rails'

gem 'devise'

Here is the error I get when I try to run bundle install:

Kelly@LAPTOP /c/Sites/my_app (master)
$ bundle install
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies..................
Using rake 12.0.0
Using concurrent-ruby 1.0.5 (java)
Using i18n 0.8.4
Using minitest 5.10.2
Using thread_safe 0.3.6 (java)
Using builder 3.2.3
Using erubi 1.6.0
Using nokogiri 1.8.0 (java)
Using rack 2.0.3
Using nio4r 2.1.0 (java)
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 8.0.0
Using bundler 1.15.1
Using method_source 0.8.2
Using thor 0.19.4
Using puma 3.9.1 (java)
Using sass 3.4.24
Using tilt 2.0.7
Using execjs 2.7.0
Using coffee-script-source 1.12.2
Using turbolinks-source 5.0.3
Using multi_json 1.12.1
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring
Fetching bindex 0.5.0
Installing bindex 0.5.0 with native extensions
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring
Using bcrypt 3.1.11 (java)
Using orm_adapter 0.5.0
Using tzinfo 1.2.3
Using loofah 2.0.3
Using rack-test 0.6.3
Using sprockets 3.7.1
Using warden 1.2.7
Using websocket-driver 0.6.5 (java)
Using mime-types 3.1
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using turbolinks 5.0.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13/ext/sqlite3
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170707-17112-s04bux.rb extconf.rb
checking for sqlite3.h... RuntimeError: The compiler failed to generate an
executable file.
You have to install development tools first.

                 try_do at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:456
                try_cpp at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:587
   block in find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1144
  block in checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:942
      block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350
                   open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320
      block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350
                   open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320
               postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:346
           checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:941
            find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1143
                 <main> at extconf.rb:50
*** 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:/jruby-9.1.8.0/bin/jruby
        --with-sqlite3-config
        --without-sqlite3-config
        --with-pkg-config
        --without-pkg-config
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13 for inspection.
Results logged to
C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/gem_make.out

An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.

In Gemfile:
  sqlite3

Here is the error I get when I try to run gem install sqlite -v '1.3.13':

Kelly@LAPTOP /c/Sites/my_app (master)
$ gem install sqlite3 -v '1.3.13'
Building native extensions.  This could take a while...
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    current directory: C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13/ext/sqlite3
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170707-17048-ojikan.rb extconf.rb
checking for sqlite3.h... RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.

                 try_do at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:456
                try_cpp at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:587
   block in find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1144
  block in checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:942
      block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350
                   open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320
      block in postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:350
                   open at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:320
               postpone at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:346
           checking_for at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:941
            find_header at C:/jruby-9.1.8.0/lib/ruby/stdlib/mkmf.rb:1143
                 <main> at extconf.rb:50
*** 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:/jruby-9.1.8.0/bin/jruby
        --with-sqlite3-config
        --without-sqlite3-config
        --with-pkg-config
        --without-pkg-config
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/sqlite3-1.3.13 for inspection.
Results logged to C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/gem_make.out

Any help is appreciated as I cannot move forward until I run a successful bundle install and I've tried researching for days and cannot figure out how to fix this.

Updated 7/9/17: Here is my updated Gemfile where I am still not able to run bundle install nor bundle update:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.1'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# 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', platforms: [:mri, :mingw, :x64_mingw]
  # Use sqlite3 as the database for Active Record
    gem 'sqlite3', platform: :ruby
    gem 'jdbc-sqlite3', platform: :jruby
    gem 'activerecord-jdbc-adapter', platform: :jruby
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :production do 
    gem 'pg' 
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'jquery-rails'

gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3', '>= 1.3.23'

Updated 7/10/17: After removing gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3', '>= 1.3.23', I tried bundle install again and this time, I got a different error:

Kelly@LAPTOP /c/Sites/my_app (master)
$ bundle install
The dependency sqlite3 (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32, java but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`.
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies........................
Using rake 12.0.0
Using concurrent-ruby 1.0.5 (java)
Using i18n 0.8.4
Using minitest 5.10.2
Using thread_safe 0.3.6 (java)
Using builder 3.2.3
Using erubi 1.6.0
Using nokogiri 1.8.0 (java)
Using rack 2.0.3
Using nio4r 2.1.0 (java)
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 8.0.0
Using bundler 1.15.1
Using method_source 0.8.2
Using thor 0.19.4
Using puma 3.9.1 (java)
Using sass 3.4.24
Using tilt 2.0.7
Using execjs 2.7.0
Using coffee-script-source 1.12.2
Using turbolinks-source 5.0.3
Using multi_json 1.12.1
Using jdbc-sqlite3 3.15.1
Fetching bindex 0.5.0
Installing bindex 0.5.0 with native extensions
C:/jruby-9.1.8.0/lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb:56: warning: Tempfile#unlink or delete called on open file; ignoring
Using tzinfo 1.2.3
Using loofah 2.0.3
Using rack-test 0.6.3
Using sprockets 3.7.1
Using websocket-driver 0.6.5 (java)
Using mime-types 3.1
Using uglifier 3.2.0
Using coffee-script 2.4.1
Using turbolinks 5.0.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex
C:/jruby-9.1.8.0/bin/jruby.exe -r ./siteconf20170710-21728-1asiecp.rb extconf.rb

current directory:
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.

current directory:
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0/ext/bindex
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.

make failed, exit code 1

Gem files will remain installed in
C:/jruby-9.1.8.0/lib/ruby/gems/shared/gems/bindex-0.5.0 for inspection.
Results logged to
C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/bindex-0.5.0/gem_make.out

An error occurred while installing bindex (0.5.0), and Bundler cannot continue.
Make sure that `gem install bindex -v '0.5.0'` succeeds before bundling.

In Gemfile:
  web-console was resolved to 3.5.1, which depends on
    bindex
kellyb
  • 61
  • 2
  • 6
  • You are running `gem installsqlite3 -v '1.1.13'` and need a space `gem install sqlite3 -v '1.1.13'` – jdgray Jul 07 '17 at 23:27
  • Ah yes. I just added a space, but I am still getting an error. I updated my question to show the error when I add the space and try to run it again. – kellyb Jul 07 '17 at 23:41
  • `RuntimeError: The compiler failed to generate an executable file. You have to install development tools first.` ---- `To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-java-1.8/2.3.0/sqlite3-1.3.13/mkmf.log` probably between these two you can figure out the solution – m3characters Jul 08 '17 at 00:11
  • I can't find C:/jruby-9.1.8.0/lib/ruby/gems/shared/extensions/universal-j‌​ava-1.8/2.3.0/sqlite‌​3-1.3.13/mkmf.log in my Windows Explorer and do you know which development tool I need to install? – kellyb Jul 08 '17 at 00:17
  • If you can't find JRuby, is there some reason to suspect that you ever installed it? Did you install the JDBC gem for JRuby? This is where I suspect your issue originates. JRuby had problems with SQLite in the past, but I don't know if that situation persists today. – MarsAtomic Jul 08 '17 at 01:29
  • I actually just found the file. Here is what the log says: package configuration for sqlite3 is not found " -o conftest.exe -I/include/universal-java1.8 -IC:/jruby-9.1.8.0/lib/ruby/include/ruby/backward -IC:/jruby-9.1.8.0/lib/ruby/include -I. -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions -W3 conftest.c -L. -LC:/jruby-9.1.8.0/lib -LC:/jruby-9.1.8.0/lib/native/x86_64-Windows -m64 -march=native -mtune=native " checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include 4: int main(int argc, char **argv) 5: { 6: return 0; 7: } /* end */ – kellyb Jul 08 '17 at 01:32
  • How do I install the JDBC gem for JRuby? – kellyb Jul 08 '17 at 01:36
  • 1
    @kellya Just so you know, if you direct a comment at a specific user, as I have here, that user receives a notification in their navbar. You don't have to depend on that user to remember to go back to your question when you update it with more information. Not sending a notification means you'll have to rely on my attention span, which is... Oh look a shiny object! – MarsAtomic Jul 08 '17 at 02:43

3 Answers3

6

There has been a perfect answer. Check out the article "An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue Cannot create rails app" in stackoverflow.

I quote the following solution

It's failing because you are missing a dependency. You can get it by running sudo apt-get install libsqlite3-dev

Eric Andrews
  • 936
  • 8
  • 10
2

The gem activerecord-jdbcsqlite3-adapter is not yet compatible with Rails 5. I was able to successfully use JRuby with Rails 4.1.3, from a couple of years ago. The team working on JDBC adapters operates on an open source basis, which general means they work for free, so you get what you get.

You have two choices:

1) Uninstall JRuby and use Rails 5 with an MRI-based interpreter; or

2) Use JRuby with an older version of Rails, like 4.2.9 or lower.

My suggestion is to stick with option 1, since you don't have to do anything special at all -- MRI is the normal Ruby interpreter. You also never explained your reasons for choosing JRuby, which makes me suspect a bit of an XY Problem. If you go with option 2, please review your reasons for selecting JRuby and make sure you know both what you're doing and why you're doing it.

MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
  • thank you for your response! Where in my Gemfile do I put: gem 'sqlite3', platform: :ruby gem 'jdbc-sqlite3', platform: :jruby gem 'activerecord-jdbc-adapter', platform: :jruby How do I know what my db name is? Lastly, I got an error when trying to run rails server: Could not find gem 'activerecord-jdbcsqlite3-adapter (>= 1.3.23, ~> 1.3) x86-mingw32' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. Tried running bundle install, but it asked me to run bundle update, which I did but then it asked me to run bundle install. – kellyb Jul 08 '17 at 19:34
  • The gem was not found because you didn't change your gemfile. Include that snippet in the development block of your gemfile, after which you should run bundle install. Also, post an update of your gemfile, because I suspect you've updated it between your original posting and now, but you haven't indicated whether or how it was changed. – MarsAtomic Jul 08 '17 at 22:56
  • @kellya `Could not find gem 'activerecord-jdbcsqlite3-adapter (>= 1.3.23, ~> 1.3) x86-mingw32'` is caused by the line in your gemfile reading `gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3', '>= 1.3.23'.` Get rid of it. – MarsAtomic Jul 10 '17 at 02:48
  • I think we are making some progress, but I'm not all the way there yet. I removed the last line in my Gemfile and tried running bundle install again and it still didn't work, but it gave me a different error this time (see above). I tried running gem install bindex -v '0.5.0' per the error messages request, but that didn't work either. @MarsAtomic – kellyb Jul 10 '17 at 16:55
  • @kellya Here's your final verdict. No BS: these guys are really backed up. My suggestion would be to stop making life difficult for yourself (and for me by extension) and stick to vanilla installations (i.e. no JRuby) until you know what you're doing. – MarsAtomic Jul 10 '17 at 22:12
  • Thank you for your help @MarsAtomic – kellyb Jul 10 '17 at 22:23
  • @kellya See that empty checkmark to the left of my answer? Give it a click to accept the answer so that other people stumbling across this issue know what solved your problem, and can avoid having to do all the reading I did. – MarsAtomic Jul 10 '17 at 22:47
  • Thank you for your help, but unfortunately the problem has not been solved yet, but once I figure it out, I will mark my question as solved. @MarsAtomic – kellyb Jul 11 '17 at 17:00
  • @kellya JRuby doesn't work with Rails 5, full stop. There are a bunch of people who know the codebase to the adapter who haven't gotten around to resolving the issue, so I'm not optimistic about your chances. Just because you didn't get what you wanted doesn't mean the issue wasn't resolved -- you got the truth, even if you don't like it. – MarsAtomic Jul 11 '17 at 18:02
  • I tried your solution and it didn't work. I uninstalled JRuby and it still didn't work. Thanks for the time you put in to help me, but I don't need your help anymore and don't need the insults. @MarsAtomic – kellyb Jul 17 '17 at 22:15
  • @kellya: we must be looking at different posts since I have scoured mars atomic's post and have yet to find an insult, harsh truth, yes, but no insult. Please consider looking at his comments and answer through glasses with a softer lens. – Hovercraft Full Of Eels Jul 17 '17 at 22:32
  • He edited his original comment to me, which you did not see, but I did. @Hovercraft Full Of Eels – kellyb Jul 19 '17 at 05:33
  • @HovercraftFullOfEels As experienced users know, comments cannot be edited after 5 minutes, and the timestamps of the comments here demonstrate that kellya would not have seen any edits, even if they'd happened. Obstinance is one thing. Lying is quite another. What we see here is, unfortunately, an example of the tragedy of the commons. For some, time isn't valuable unless it's your own. People are entitled to their own opinion. They are not, however, entitled to their own (alternative) facts. – MarsAtomic Jul 24 '17 at 02:12
0

This is a very common problem when running a Rails App.

The answer is at this link: https://github.com/sparklemotion/sqlite3-ruby/issues/224

or this Youtube video: https://www.youtube.com/watch?v=G-B_KUFNkQQ&t=556s

Instructions:

Step 1: Open your Gemfile

Step 2: Find where it says:

gem 'sqlite3'

and change this to:

gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

(Run "bundle install" if the server still doesn't run.)

Ahmedakhtar11
  • 1,076
  • 11
  • 7