Problem in SQLite3 installation - ruby-on-rails

The following error comes up:
C:\gem>gem install sqlite3-ruby --local
Building native extensions. This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
checking for #include <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
--srcdir=.
--curdir
--ruby=C:/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}/lib
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1
.3.0 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.0/ext/sqlite3/
gem_make.out
I have copied all the necessary files required in the Ruby/Bin folder, still it keeps reporting this error that sqlite3.h is missing.
Please do tell where do I have to place sqlite3.h, when I am installing the gem locally as you can see and I am currently using 1.3.0 version of SQLite3 for its installation.
I have tried with the solutions that were posted for similar problems. And I am using Windows XP.
Thanks in advance.

I had this problem. This is the solution I found. It's not very pretty, but it worked for me. In my case, I was using cygwin. There's probably a similar way to do it without using cygwin, but I don't know how.
1) Download the source of SQLite. I went for SQLite 3.6.23, somewhat arbitrarily, via this URL:
http://www.sqlite.org/src/info/4ae453ea7b
If that doesn't work, then go to the release timeline at http://www.sqlite.org/src/timeline?n=200&t=release&y=ci , choose a release, and download the ZIP file of it.
2) Unpack the ZIP archive somewhere. Go to that directory in cygwin. Execute these commands:
./configure
make
make sqlite3.dll
make install
3) Copy the sqlite3.exe and sqlite3.dll from the directory where make created them into somewhere on your path.
4) Once that's done, gem install sqlite3-ruby finally worked.
I was following this guide: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/240902

I know this has been closed for a while but I was having the same issue and this
helped. Install apt-cyg. First install subversion and wget through the standard
cygwin setup program. Then run the following commands:
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Now using apt-cyg install the sqlite3 development:
apt-cyg install libsqlite3-devel
and finally
$ gem install sqlite3-ruby
Building native extensions. This could take a while...
Fetching: sqlite3-ruby-1.3.3.gem (100%)
#######################################################
Hello! The sqlite3-ruby gem has changed it's name to just sqlite3. Rather than
installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
dependencies accordingly.
Thanks from the Ruby sqlite3 team!
<3 <3 <3 <3
#######################################################
Successfully installed sqlite3-1.3.6
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
Installing ri documentation for sqlite3-1.3.6...
Installing ri documentation for sqlite3-ruby-1.3.3...
Installing RDoc documentation for sqlite3-1.3.6...
Installing RDoc documentation for sqlite3-ruby-1.3.3...

I got it working by following these suggestions: http://www.skorks.com/2009/08/installing-and-using-sqlite-with-ruby-on-windows/
Basically you can download from sqlite.org, the DLL and shell file and make sure you copy the DLL in each of the ruby versions you have installed, in their /bin directory. You can place the shell file somewhere in your system path, I have a folder c:\bin. Then you can install pik gem install sqlite3

replace with sqlite3 (1.3.10-x64-mingw32) in Gemfile.lock worked for me.

Related

RMagick installs using devkits msys.bat but not using gitbash

(I am using Windows 8)
I finally got the rmagick gem to install by opening the msys.bat file in my Devkit folder using this command
gem install rmagick --platform=ruby -- --with-opt-lib=c:/imagemagick/lib --with-opt-include=c:/imagemagick/include
This is the output
Building native extensions with: '--with-opt-lib=c:/imagemagick/lib --with-opt-i
nclude=c:/imagemagick/include'
This could take a while...
Successfully installed rmagick-2.15.0
Parsing documentation for rmagick-2.15.0
Done installing documentation for rmagick after 6 seconds
1 gem installed
But when I run the same exact command using gitbash I get this error:
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-opt-lib=c:/imagemagick/lib --with-opt-include=c:/imagemagick/include'
This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
c:/RailsInstaller/Ruby2.1.0/bin/ruby.exe extconf.rb --with-opt-lib=c:/imagemagick/lib --with-opt-include=c:/imagemagick/include
Invalid drive specification.
Unable to get ImageMagick version
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/RailsInstaller/Ruby2.1.0/bin/ruby
extconf failed, exit code 1
Gem files will remain installed in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rmagick-2.15.0 for inspection.
Results logged to c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/rmagick-2.15.0/gem_make.out
I get this same exact error when running bundle install using gitbash and when I try to run bundle install using msys.bat I get the same error but its a bit longer and complains about development tools.
If it works using msys.bat, what do I need to change to get it to work with gitbash and with bundle installs?
EDIT: I did the same command using msys.bat but specified rmagick -v '2.13.3' and bundle install worked. My gemfile doesn't specify a version so not sure why 2.15.0 didn't work. Anyways things are working...so far. But I do think I should think about switching from windows like the first comment suggests due to all the problems I've faced so far with windows.

Unable to install Rails extconf.rb failed

I'm new to Ruby on Rails, and I'm getting the below error when I'm installing it.
Please note, I have installed the latest Xcode and installed command line tools, and I'm using OSX 10.8.4. I've installed Ruby 2.0.0 as well.
-bash-3.2$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** 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/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:24:in `<main>'
Gem files will remain installed in /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12 for inspection.
Results logged to /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem_make.out
I had similar problem and it gets solved by installing command line tools:
xcode-select --install
The symlinking did not solve the problem for me. I uninstalled my ruby that I previously had installed using rvm by typing rvm uninstall ruby-2.0.0 and then I typed rvm requirements. This command found that I needed a few other things, such as gcc46. It's strange that the gcc compiler was needed, even though I had installed the xcode command line tools, and gcc was most definitely installed on my system.
So, if none of the usual methods are working, give rvm requirements a shot!
I guess it's a same problem with this question.
Try sudo ln -s /usr/bin/{llvm-,}gcc-4.2 and gem install rails again.
By the way, you're in your own home directory, you don't have to use sudo.
I just ran into this with ruby 2.5.3 and was able to install cairo by calling:
PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig gem install cairo -v '1.15.2'
Took a while to find something that worked, as I already had the command line tools installed, and am using asdf not rvm.
Thanks to this thread for helping with the fix: https://github.com/ruby-gnome2/ruby-gnome2/issues/259#issuecomment-59751807

Unable to install SQLite3 gem on Ruby 1.9.3, no issues with Ruby 2.0.0. What's the difference?

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/

Unable to install MySQL2 gem on Windows 7

I am getting the following error message while installing, let me know if I need to post more details.
I followed instructions from the following location:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
I am using ruby 1.9.2p136 (2010-12-25) [i386-mingw32].
Here is what I get:
E:\work_desk\trunk>gem install mysql2 -v 0.2.4
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
C:/Ruby192/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... 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=C:/Ruby192/bin/ruby
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-libmysqllib
--without-libmysqllib
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.
2.4 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.4/ext/mysql2/ge
m_make.out
The specific version of mysql2 gem you're trying to install (0.2.4) not only lacks binaries for Windows, but have issues on Windows.
Please install mysql2 gem without indicating the version:
gem install mysql2
Which will install latest version (0.2.6 at the time of my posting this) and also provides binaries for Windows which skip the compilation step.
If you still want to force the compilation (because your version of MySQL differs from the one used to generate the binary gem, you will need to install RubyInstaller's DevKit from RubyInstaller website:
http://rubyinstaller.org/downloads
And follow the DevKit installation instructions from our wiki (that is linked from the download page)
You will need to provide the path to both headers and libraries during the gem installation process, and adjust the MySQL installation location from the following instructions:
subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.1"
gem install mysql2 --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:\lib\opt
subst X: /D
The above command uses subst to avoid issues with path with spaces, which you should avoid always.
Hope this helps.
After searching around for a way to make it work, I finally got it installed with the following on the command prompt:
gem install mysql2 -v 0.2.6
With the following results:
Fetching: mysql2-0.2.6-x86-mingw32.gem (100%)
Successfully installed mysql2-0.2.6-x86-minw32
1 gem installed
Installing ri documentation for mysql2-0.2.6-x86-mingw32...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.2.6-x86-mingw32...
Enclosing class/module 'mMysql2' for class Client not known
Try it. It should work.
If still not able to install mysql2 gem on windows7 or not very clear on the steps to follow, then please go through this post which will help you in step-by-step installation -
http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html
And for mysql_api.so error (C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/mysql_api.so), copy "libmySQL.dll" file from C:\Program Files\MySQL\MySQL Server 5.1\bin to C:\Ruby192\bin
Path of installation may vary, for details refer to this post - http://rorguide.blogspot.com/2011/03/getting-error-specified-module-could.html.
Hope, this will help you in sorting out your issues.
Start with RailsInstaller.
This is assuming you are running the mysql server locally (local development), and your Ruby is compiled 32-bit. (Check ruby -v. x64 || i386.)
Download the mysql-community-web-installer. In the top right select 32-bit. You pretty much just need the Server. The Workbench is handy also.
The gem command needs a path without spaces, so use subst:
subst X: "C:\Program Files (x86)\MySQL\MySQL Server 5.6"
gem install mysql2 -v=0.3.13 --platform=ruby -- --with-mysql-dir=X:
You will need libmysql.dll in the PATH -- the easiest thing is just to copy it to Ruby's bin directory:
copy "C:\Program Files (x86)\MySQL\MySQL Server 5.6\lib\libmysql.dll" "C:\RailsInstaller\Ruby2.0.0\bin"
NOTES
Don't do this from PowerShell! (DevKit has trouble changing path info in powershell.)
Make sure all libraries are 32-bit, since RailsInstaller's ruby etc. are all compiled 32-bit and need to link to 32-bit libraries.
If you don't want a server locally, just install the C Connector, and do these instructions with that directory and libmysql.dll. Don't mix and match -- make sure the .dll matches the version you compiled the gem against.
From this:
checking for main() in -llibmysql... no
it looks like you haven't installed the MySQL drivers and apps. If so, were they allowed to install into their default locations? At a minimum you'll want the client software if the server is running on a different machine.
install 32 bit mysql connector/c get it at here
copy libmysql.dll from the directory that you install the connector/c to the %installed ruby directory%/bin/
then reinstall the gem again.
I've tried the solution of #Mrk Fldig but it didn't work...
So what solved the problem was:
Downloaded the lastest MySQL Installer for windows 7 32 bits
Installed the gem with the following command: gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:/Program Files/MySQL/MySQL Connector C 6.1 6.1.2/"'
One pitfall to be aware of is that I changed the backslashes (\) to normal slashes (/). I've tried the same procedure with backslashes and it didn't work.
The installer already includes the C connectors for MySQL at MySQL Connector C 6.1 6.1.2 directory. Therefore, passing only the --with-mysql-dir parameter without the --with-mysql-lib or --with-mysql-include parameters, makes the gem to look at the same directory for the lib and include directories

How to install mysql gem on Mac os 10.6?

i just installed MAMP on this iMac and the rubygems but when i run:
sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
gives me
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
ERROR: could not find gem — locally or in a repository
ERROR: could not find gem –with-mysql-config=/usr/local/mysql/bin/mysql_config locally or in a repository
how can i install this gem ?
I found this and worked out perfectly:
you can go to http://www.tmtm.org/en/ruby/mysql/ to download the tar
file, and run the command below
# ruby ./install.rb
to install the mysql.rb
Use the following it worked with me
brew install mysql
Do you have the Xcode developer tools installed on Mac OS X? If not, I'd start there.
You can download them here: http://developer.apple.com/technologies/xcode.html
Once you've installed that, try again.
i'm still getting this
$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
--with-mysql-config
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
You need the mysql development libs to compile it. If you were on linux you could use "yum install mysql-devel". Not sure about how to get them installed on a mac, but try downloading the connector libraries from here:
MySql Connector Downloads
You may have to pass in a --with-mysql-libs option to point to the directory when the C libraries are unpacked to. Hope this points you in the right direction.
Or you can just put the libraries in the default directory:
/usr/lib64/mysql
Download mysql-dev from mysql.com

Resources