Installation of the sqlite3-ruby gem fails - ruby-on-rails

whenever I try to install the gem:
gem install sqlite3-ruby
I get the following output:
D:/Ruby/bin/ruby.exe extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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=D:/Ruby/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}/
--enable-local
--disable-local
I have properly installed sqlite3 on my Windows:
D:\>sqlite3
SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
This is my second attempt of installation and again I get the same error message.

The problem was that I was using ruby 2.x (currently beta and not working with sqlite3) instead of 1.9.3.

You need to install SQLite first, so that you get the development headers required for the ruby gem to work.
Go to http://mislav.uniqpath.com/rails/install-sqlite3/#windows, and follow the instructions. Then the gem installation should succeed.

Obviosly your error-message says "Install SQLite3 ... first."
try:
gem install sqlite3
please keep me informed if this solved your problem.

Related

bundle cant install sqlite3 -v 1.4.0

I'm new to ruby on rails, having a problem with installing sqlite3 -v 1.4.0
each time I run bundle install
and am not able to start rails server because of this.
I am on windows 7
current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190428-4968-1wrdwr0.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlcipher
--without-sqlcipher
--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:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0'` succeeds before bundling.
In Gemfile:
sqlite3
c:\Sites\blog>
Your error contains a recommendation inside it:
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first
sqlite3 gem is only a wrapper around it, you need SQLite in your system to compile and install it.
type ridk exec pacman -S mingw-w64-x86_64-dlfcn in command line, install this, and try again

I am getting this error while executing cmd "rails new test_install" on my windows

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190220-5856-12t9mtl.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first.
* 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:/RailsInstaller/Ruby2.3.3/bin/$(RUBY_BASE_NAME)
--with-sqlcipher
--without-sqlcipher
--with-sqlite3-config
--without-sqlite3-config
--with-pkg-config
--without-pkg-config
--with-sqlcipher
--without-sqlcipher
--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:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' succeeds before bundling.
In Gemfile:
sqlite3
Probably, you use rails in 5.2.2 version. Solution is change version of sqlite to 1.3.6:
gem 'sqlite3', '~> 1.3.6'
After this change run command:
bundle update
I have got the same issue and tried for more than a week a lot of solutions the only one worked for me was uninstall RailsInstaller only install Ruby DevKit (make sure all the folders of RailsInstaller installation are gone or you'll see a message "C:/RailsInstaller/Ruby2.3.3/bin" cannot be found when trying to use gem command) install rails by command line C:/Sites > gem install rails and install MinGW
C:\Sites>ridk exec pacman -S mingw-w64-x86_64-dlfcn
Download the SQLite3 gem from https://rubygems.org/, save it locally and install it from file
C:\Sites>gem install --local C:\sqlite3-1.4.0.gem
The good thing is it worked for all the projects that I created after.

Error installing SQlite during installation of Beef in windows

I am trying to install BEEF in Windows 10 PC by following the instructions given here:
https://github.com/beefproject/beef/wiki/Installation
I am stuck in the last step while doing bundle install.
I keep on getting this error:
Installing do_sqlite3 0.10.17 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
E:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160814-9372-uyjql9.rb extconf.rb
checking for sqlite3.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=E:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/do_sqlite3-0.10.17 for inspection.
Results logged to E:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/do_sqlite3-0.10.17/gem_make.out
Using dm-do-adapter 1.2.0
Using dm-migrations 1.2.0
Using dm-serializer 1.2.2
Using qr4r 0.4.1
Using sinatra 1.4.7
Using rubydns 0.7.3
An error occurred while installing do_sqlite3 (0.10.17), and Bundler cannot
continue.
Make sure that `gem install do_sqlite3 -v '0.10.17'` succeeds before bundling.
I have tried all workarounds I got by searching the web, like compiling the header file from source and running gem install sqlite3. But none of them work.

cant bundle rails app.sqlite3 failed

it says
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/home/Fash/.rvm/rubies/ruby-1.9.3-p194/bin/ruby.exe extconf.rb --with-sqlite3-include=/usr/local/include
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--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/Fash/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
Gem files will remain installed in /home/Fash/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/Fash/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
i am using cygwin
The problem is in compilation of required libraries to install sqlite3.
Check this SO Question for steps to solve this.

gem install sqlite3-ruby

When I try install sqlite3-ruby, I get
# gem install sqlite3-ruby
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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-1.9.2-p180/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
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
And I have this packages installed
i A libdbd-sqlite3-ruby1.8 - Ruby/DBI SQLite driver for Ruby 1.8
i A libsqlite3-0 - SQLite 3 shared library
i libsqlite3-dev - SQLite 3 development files
i libsqlite3-ruby - SQLite3 interface for Ruby
i A libsqlite3-ruby1.8 - SQLite3 interface for Ruby 1.8
i sqlite3 - A command line interface for SQLite 3
It looks like you need to update your sqlite3 version. Not any gem, but the actual sqlite3 package. Use your distribution's package manager to upgrade to a version of sqlite3 >= 3.6.16+, or compile it from source (obtainable here)

Resources