sqlite3-ruby gem: Failed to build gem native extension - windows

Update: Check out this follow-up question: Gem Update on Windows - is it broken?
On Windows, when I do this:
gem install sqlite3-ruby
I get the following error:
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 install sqlite3-ruby --platform Win32
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no
nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
Same thing happens with the hpricot gem. I seem to remember these gems installed just fine on < 1.0 gems, but now I'm on 1.2.0, things have gone screwy.
I have also tried this:
gem install sqlite3-ruby --platform Win32
Needless to say, this doesn't work either (same error)
Does anyone know what is going on here and how to fix this?
Update: Check out this follow-up question: Gem Update on Windows - is it broken?

As Nathan suggests, this does appear to be related to the fact that the latest versions of the sqlite3-ruby and hpricot gems don't appear to have Windows versions. Here's what to do when faced with this situation (note, the name of the gem is automatically wildcarded, so you can type just sql and get a list of all gems beginning with sql):
$ gem list --remote --all sqlite
*** REMOTE GEMS ***
sqlite (2.0.1, 2.0.0, 1.3.1, 1.3.0, 1.2.9.1, 1.2.0, 1.1.3, 1.1.2, 1.1.1, 1.1)
sqlite-ruby (2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2)
sqlite3-ruby (1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0.0, 0.9.0, 0.6.0, 0.5.0)
Then you can choose the version you would like to install:
gem install sqlite3-ruby -v 1.2.3
To successfully install hpricot, I did this:
gem install hpricot -v 0.6
Annoyingly, doing a gem update tries to update the gems to their latest, broken-on-Windows, versions. When the update routine encounters an error, it ditches you out of the whole process. There's a (hacky) solution to this problem here.
So, is this issue a bug in gems? Should gems not automatically detect the platform and install the latest compatible version?

I had the same problem on Ubuntu, this solved the problem for me:
http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.ruby/2008-08/msg00339.html

first from sqlite.org(http://www.sqlite.org/download.html)
download ->
Precompiled Binaries: sqlite-dll-win32-x86-3071700.zip
and Source Code: sqlite-autoconf-3071700.tar.gz
then extract as:
-include
--sqlite3.h
--sqlite3ext.h
-lib
--shell.c
--sqlite3.c
--sqlite3.def
--sqlite3.dll
last install gem like:
gem install sqlite3 --platform=ruby -- --with-sqlite3-include=path\to\include
--with-sqlite3-lib=path\to\lib --no-ri --no-rdoc
Good luck!

Is it possible that the newest version has not yet been ported to Win32 yet? Since this particular gem does have bindings to compiled code, it would require a platform-specific gem. If I force installation of version 1.2.3 rather than the current 1.2.4, the platform-specific version does install, but when I allow gem to try to install the current version, I get the generic 1.2.4 version (in the gems library folder, it lacks the -x86-mswin32 suffix that the other sqlite3-ruby folders have in their names.
Maybe someone else can answer how gem handles platform specific gems. Are separate gems uploaded for each platform and the gem software selects which one to pull down?

I also ran into this problem. It's worth knowing that the difference between 1.2.3 and 1.2.4 is not significant. Here are the 1.2.4. release notes:
Release Name: 1.2.4
Notes: This release only updates the
generated C file to reflect the
compatibility changes that were made
to the SWIG file. Binary builds (e.g.,
Windows) are not affected, and need no
update. In general, you will not need
this update unless you are using a
version of Ruby prior to 1.8.6.
(source: 1.2.4. release notes)
Hope that helps others!

I had the same problem on Windows and I have installe MinGW
http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW%205.1.6/MinGW-5.1.6.exe/download
and the problem has gone :-)
C:>gem install hpricot
Successfully installed hpricot-0.8.2-x86-mswin32
1 gem installed
Installing ri documentation for hpricot-0.8.2-x86-mswin32...
Installing RDoc documentation for hpricot-0.8.2-x86-mswin32...
C:>gem install ruby-postgres
Successfully installed ruby-postgres-0.7.1.2006.04.06-x86-mswin32
1 gem installed
Installing ri documentation for ruby-postgres-0.7.1.2006.04.06-x86-mswin32...
Installing RDoc documentation for ruby-postgres-0.7.1.2006.04.06-x86-mswin32...

Related

Bundler could not find compatible versions for gem "bundler", but gem list does not have the version that it says is installed

I'm using rbenv, ruby 2.6.5, and attempting to use bundler 2.0.2. Currently when I run gem list, bundler 2.0.2 is the only version shown on the screen. However, when I run bundle install in my project, an error is thrown stating that my current bundler version is 2.1.2. If I run bundler version in the shell, it indeed says 2.1.2. Where can I find this version and eliminate it?
Thanks,
Ed
Uninstall all versions of bundler with gem uninstall bundler and install the version you need again.

Updating Ruby to 2.0.0 using Pik

After installing pik and changing my Ruby version to 2.0.0, bundler no long works properly
C:\Users\Me\Documents\Work Projects\Application>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Installing atomic (1.1.14)
Gem::InstallError: The 'atomic' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
Installing the devkit from Ruby Installer sort of defeats the reason why I went to the trouble of installing pik. How can I fix this, so that in the future, I can easily update ruby using pik and still have everything working?
I had the same problem - if you follow the instructions listed (ie installing devkit and following their directions [they don't actually tell you to use rubyinstaller]), you'll be fine. Also make sure that during the init phase of the Devkit instructions that it doesn't miss any of your ruby installations.
A note though, it seems that pik can't specify the x64 version of 2.0.0, so you may run into problems if that's the case. In the end I had to use the rubyinstaller for the x64 version of ruby, and then ran the x64 version of the devkit.
Hope this helps.
I think Josh' answer is probably right, but I actually installed Ubuntu as a VM in the end, just so I could use RVM.
RVM is a thousand times better than Pik, and it installs the DevKit. It's so good it's genuinely worth installing Ubuntu just so you can use it.

Ruby and gem version compatibility

I had an SSH-session to some Ubuntu Server. The latest available Ruby package with -full was an apt-get install ruby1.9.1-full. But after apt-get install rubygems1.9.1 the problem was that:
root#...:~# gem install nokogiri
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2
And I didn't know, which version of Nokogiri I had to install. I tried to guess:
root#...:~# gem install nokogiri -v 1.5.10
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
..........bla..bla..bla...
and had to switch to RVM way (there I had 1.9.3 and no further problems with gems I needed).
But anyway I prefer non-RVM way, so the question is: How do I know, which version of the gem is compatible with my Ruby?
Inspecting from the CHANGLOG.rdoc of Nokogiri in its source:
1.6.0.rc1 / 2013-04-14
This release was based on v1.5.9, and so does not contain any fixes mentioned in the notes for v1.5.10.
Notes
mini_portile is now a runtime dependency
Ruby 1.9.2 and higher now required
Features
(MRI) Source code for libxml 2.8.0 and libxslt 1.2.26 is packaged with the gem. These libraries are compiled at gem install time unless the environment variable NOKOGIRI_USE_SYSTEM_LIBRARIES is set. VERSION_INFO (also `nokogiri -v`) exposes whether libxml was compiled from packaged source, or the system library was used.
(Windows) libxml upgraded to 2.8.0
Deprecations
Support for Ruby 1.8.7 and prior has been dropped
You may give the previous version a try, say 1.5.10 / 2013-06-07
For the errors of building native extension, you shall check the build log of Nokogiri. It's likely that your system missed some library dependencies, such as libxml, libyaml, etc. RVM may handle the dependency for you, in its manner, so you don't get error while building with RVM.

gem install capistrano failure

I tried to install the package "capistrano" on a linux box but got the following error:
*** buffer overflow detected ***: /usr/bin/ruby terminated
Additionally it showed me a list of the memory map and then the install process was aborted.
Any idea on what causes this error?
Cheers
Roland
I had similar issue when installing Capistrano on CentOs 6.7, Ruby 1.8.5, gem 1.3.1. Turns out the issue was caused by newest highline package.
The following allowed me to install capistrano correctly:
gem install highline --version "=1.6.2"
gem install capistrano --version "=2.6.0"
This error may be related to some Ruby 1.8.6 bugs (see this post http://opsrealism.tumblr.com/post/4931621276/mirroring-rubygems-and-ruby-9-2-on-centos-5-5 for some more details), so you may try to upgrade your Ruby to 1.8.7, if it's possible.
Another option is to try to install a bit older version of gem - it worked for me on a couple of occasions, where exact gem versions didn't matter. For example,
gem install capistrano --version "=2.7.0"
might work.
I'm running:
Centos 5.5
Ruby 1.8.5
Gems 1.3.1
I narrowed the problem down to the highline gem. Although I attempted to intall all of its dependencies manually (which worked), it still failed to load itself unless I followed the above advice and specified the version, 1.6.2. =(
gem install highline --version "=1.6.2"
Hopefully, I'll be migrating off of this ancient OS soon.
I had similar issues installing cap for CentOS 5.8 but it worked using the rvm installer (to upgrade to latest ruby, I used 1.9.2p320 (2012-04-20 revision 35421) [x86_64-linux])
What I d
I yum remove ruby (to get rid of 1.8.x)
I followed simple instructions at https://rvm.io/rvm/install/ for installing rvm
gem install capistrano
cap command is found!
Hope this helps someones

watir install report failed to build gem native extension

I've installed a instantrail2.0. I want to install watir 1.65
First I installed watir-1.6.5.gem it said 302 fetching http://gems.r....
then I downlord a rubygems-update-1.3.7.gem and type
gem install --local rubygems-update-1.3.7.gem
successfully installed.
then I type in update_rubygems
next I type in gem install watir-1.6.5.gem
but it appears ERROR:Failed to build gem native extension
I searched and found an answer that 1.3.7 doesn't support win32.
then I type
gem install sqlite3-ruby -v 1.3.0 gem install watir-1.6.5.gem
ERROR:Failed to build gem native extension
gem install sqlite3-ruby -v 1.2.3 gem install watir-1.6.5.gem
ERROR:Failed to build gem native extension
How can I do next??
use a more current version of Watir
I second Zeljko, going with the latest versions of rubygems and watir totally makes sense. If you must stick to older gems, try installing Ruby DevKit and then do the gem install to see if that helps.
What version of Ruby are you using? You should be using Ruby 1.8.6 with that version of Watir. I am also wondering if part of your problem is that you are doing a local install, instead of installing from internet. Local installs of Watir are difficult because of all of its dependencies.

Resources