gem install sqlite3-ruby - ruby-on-rails

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)

Related

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.

Error installing sqlite3, Failed to build gem native extension

I've referred to the following solution on stackoverflow, yet I'm still experiencing the same issue:
(Error installing mysql2: Failed to build gem native extension),
The below command referenced in the link above did not remediate the issue:
brew install mysql
Evidently, the issue persists, returning the following output:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
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
--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.0/usr/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}/
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10 for inspection.
Results logged to /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
➜ code
I would sincerely appreciate assistance. Thank you!
The following commands remediated my issue:
brew unlink sqlite
brew install sqlite3 --universal
sudo gem install sqlite3 -- --with-sqlite3-dir=/usr/local/Cellar/sqlite/3.8.8.1
My long-time friend working in InfoSec assisted me. According to him, my SQLite3 updates were directing to the wrong bin. I hope this helps anyone experiencing the same frustrating issue. Thank you!

Ruby On Rails SQLite errors when creating new project

I've been working with ruby recently, I really like the language and have been picking it up really quick I decided it was time to try and work with the Rails framework. When I try to create a new project my typing
rails new first-site
I get the following errors I've spent hours Googling it and haven't found any similar result
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
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
--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/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
Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8/ext/sqlite3 /gem_make.out
An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.
I then run the gem install sqlite3 -v '1.3.8' and get similar errors.
I have no idea what I'm doing wrong.
Looks like you need to install sqlite
That is where the
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel'
If you have another db setup like postgres you can run it with the database switch
rails new myapp --database=postgresql
I found out I was missing developer dependencies when trying to use the MySQL gem. All is fixed now :)

Installation of the sqlite3-ruby gem fails

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.

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.

Resources