Hey, I've recently been having trouble properly installing my Sqlite3 gem. I've already tried installing sqlite3, followed by sqlite3-ruby and I keep getting an error message. Can anyone tell me what I need to do to correct this? Here's the error message:
demetriuford$ gem install sqlite3-ruby 1.3.3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/Users/demetriuford/.rvm/rubies/ruby-1.9.2-head/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=/Users/demetriuford/.rvm/rubies/ruby-1.9.2-head/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 /Users/demetriuford/.rvm/gems/ruby-1.9.2-head/gems/sqlite3-1.3.3 for inspection.
Results logged to /Users/demetriuford/.rvm/gems/ruby-1.9.2-head/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out
ERROR: Could not find a valid gem '1.3.3' (>= 0) in any repository
Try installing the sqlite3 gem instead.
sqlite3-ruby has changed name to sqlite3 .
i suggest to read the result of command
rvm notes
It suggest the lib you need to install for your system .
You need to update your systems sqlite3 library, either that or use an older version of the sqlite3-ruby gem, but I recommend the former. See this post as a possible duplicate.
Try Google'ing the error message, it's possible you're not the only person that's come across this message.
That's the first error, the second is because you're attempting to install a gem named '1.3.3', if you want to specify gem versions use the -v command.
The issue has nothing to do with the sqlite3-ruby library being 'renamed', sqlite3 is now just aliased to sqlite3-ruby, the latter is still supported.
First try to install latest sqlite3 in your system via package manager (if you are in UNIX-like system) or the usual way if you on Windows.
After try installing sqlite3 gem again. If you get an error supply the following informations:
OS, OS Version, SQLite3 version, ruby version.
Best Regards,
Related
I've been trying to install pdf-extract as a gem in my Rails app. When I go to build, I get this error because it uses sqlite as a dependency:
Fetching sqlite3 1.3.13
Installing sqlite3 1.3.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/home/vagrant/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20180425-3298-14ft47q.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'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=/home/vagrant/.rbenv/versions/2.3.0/bin/$(RUBY_BASE_NAME)
--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:
/home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/sqlite3-1.3.13/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/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:
pdf-extract was resolved to 0.1.1, which depends on
sqlite3
Is there anyway I can still use pdf-extract? Heroku doesn't allow sqlite in production.
Any help is greatly appreciated.
EDIT:
For those who encounter this issue in the future: I attempted to hack the gem to get it to work with postgres--this seemed to work though it caused the gem's performance to tank. Ultimately, I created an entirely separate api-only app, deployed directly to AWS using Elastic Beanstalk rather than through Heroku so that app could use sqlite3, and called the api-app to implement the gem functionality in my original app.
This approach would likely work well for any gems that cause dependency issues in a preexisting Rails app.
There is no way to use a gem that has a dependency if you cannot install that dependency. Your options are to
Use a different PDF Gem
Use an alternative to Heroku
Find a way to implement the functionality you need from Pdf-extract yourself without using any gems
Go through the gem's code to see where it uses sqlite and try to get rid of that code without breaking the gem
I would save yourself the time and trouble involved with getting this to work and look at alternative libraries. There is a PDF text extraction gem called HyPDF that is also a Heroku add-on.
I'm trying to install the Metasploit framework (unimportant) and bundler is attempting to install sqlite3, which is where it fails consistently. Sqlite3 is installed (executing sqlite3 at the command line brings me into the environment) and is linked using brew link sqlite3 (and adding the --force, for some reason) but bundler install fails each time with this error:
sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'brew install sqlite3',
'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-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}/
--with-pthreadlib
--without-pthreadlib
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.12 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/sqlite3-1.3.12/ext/sqlite3/gem_make.out
I finally managed to solve this by specifying the built-in Mac OS X sqlite library directory on macOS Sierra 10.12.5 (16F73):
$ whereis sqlite3
/usr/bin/sqlite3
# if binary is in /usr/bin then library is typically in /usr/lib
$ gem install sqlite3 -- --with-sqlite3-lib=/usr/lib
Building native extensions with: '--with-sqlite3-lib=/usr/lib'
This could take a while...
Successfully installed sqlite3-1.3.13
Parsing documentation for sqlite3-1.3.13
Done installing documentation for sqlite3 after 0 seconds
1 gem installed
I tried specifying the Homebrew library directory but for some reason it didn't work:
$ brew ls --verbose sqlite3
/usr/local/Cellar/sqlite/3.19.3/.brew/sqlite.rb
/usr/local/Cellar/sqlite/3.19.3/bin/sqlite3
/usr/local/Cellar/sqlite/3.19.3/include/msvc.h
/usr/local/Cellar/sqlite/3.19.3/include/sqlite3.h
/usr/local/Cellar/sqlite/3.19.3/include/sqlite3ext.h
/usr/local/Cellar/sqlite/3.19.3/INSTALL_RECEIPT.json
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.0.dylib
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.a
/usr/local/Cellar/sqlite/3.19.3/lib/libsqlite3.dylib
/usr/local/Cellar/sqlite/3.19.3/lib/pkgconfig/sqlite3.pc
/usr/local/Cellar/sqlite/3.19.3/README.txt
/usr/local/Cellar/sqlite/3.19.3/share/man/man1/sqlite3.1
$ gem install sqlite3 -- --with-sqlite3-lib=/usr/local/Cellar/sqlite/3.19.3/lib
This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
...
If someone knows how to specify the Homebrew library directory, please let me know because that would provide a little more control over installation (supposedly MacPorts works but I no longer use it).
For anyone curious, here's the full command to install Ruby's Sequel:
gem install sequel mysql sqlite3 -- --with-sqlite3-lib=/usr/lib
And how to convert a Laravel Homestead MySQL database listening on host port 3306 to SQLite from my comment on the question:
sequel mysql://homestead:secret#192.168.10.10:3306/my_database -C sqlite://my_database.sqlite
This worked for me on Mac High Sierra OS 10.13
gem install sqlite3 -- --with-sqlite3-lib=/usr/lib
Digging into the mkmf.log who you will find by replacing the last part of the file pointer to the log of the installation attempt. In my case:
Results logged to ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/gem_make.out
so I find the mkmf.log here:
~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/mkmf.log
I found a more explicit description of the errors:
conftest.c:13:15: error: implicit declaration of function 'pthread_create' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
conftest.c:13:15: error: implicit declaration of function 'sqlite3_libversion_number' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
So adding the --with-cflags="-Wno-error=implicit-function-declaration" made the trick!
gem install sqlite3 -- --with-cflags="-Wno-error=implicit-function-declaration"
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!
Like the title says...
I've been teaching myself RoR the past few weeks and I'm confused about something.
I went through the tutorial here no problem. No issues installing gems or anything. Now I've decided to learn more from this book. So I installed 1.9.3 with rvm and found myself unable to install SQLite3.
What's the issue? It installed fine on the newer version and once I switched back to Ruby 2.0.0 I had no issues installing that version of SQLite. If it helps, I'm on Mac OS 10.6.8.
Here's the Terminal output from my failures:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/ME/.rvm/rubies/ruby-1.9.3-p429/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'
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=/Users/ME/.rvm/rubies/ruby-1.9.3-p429/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
--enable-local
--disable-local
--with-sqlite3lib
--without-sqlite3lib
Gem files will remain installed in /Users/ME/.rvm/gems/ruby-1.9.3 p429#rails3tutorial2ndEd/gems/sqlite3 1.3.5 for inspection.
Results logged to /Users/ME/.rvm/gems/ruby-1.9.3-p429#rails3tutorial2ndEd/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
sudo apt-get install libsqlite3-dev
if you are using using debian bases distro.
sudo yum install sqlite-devel
if you are using redhat based distro.
do gem install sqlite3 after that. That should work
I never used a mac but use rvm to install rails. on the command line hit rvm requirements and install all the packages listed there.
I had a similar problem. If you don't mind resetting your gems, then follow the option below.
Go to the below link and download the installer for your operating system.
It installs everything perfectly and quickly all in 1 working package.
http://railsinstaller.org/
In the past I used RMagick and also had Imagemagick, and recently I bundle installed a newer version of RMagick.
When restarting my rails server I got errors. So I decided to uninstall first imagemagick (from brew) and then uninstall rmagick.
I tried re-installing rmagick and I am some trouble (first one being I can't install from the bundle command). I tried gem install rmagick -v '2.13.1' but I get the following permission error:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/username/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper
I also tried with the sudo and got
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/username/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper
usercomputer:~ Username$ sudo gem install rmagick -v '2.13.1'
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /Users/username/.rvm/gems/ruby-1.9.3-p194/bin:/Users/Aurelien/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/username/.rvm/rubies/ruby-1.9.3-p194/bin:/Applications/MAMP/bin/php5/bin:/Applications/MAMP/htdocs/cake/cake/cake/console:/Users/username/.rvm/gems/ruby-1.9.3-p194/bin:/Users/username/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/username/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/username/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
*** 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=/Users/username/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
Gem files will remain installed in /Users/username/.rvm/gems/ruby-1.9.3-p194/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/username/.rvm/gems/ruby-1.9.3-p194/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Surely I have done something wrong along the way, but I am not sure what?
Thank you for you answers.
It seems the latest version of ImageMagick is not compatible with RMagick. I solved the issue by following this:
http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/