This is a follow-up to this question.
When I issue the gem update
command on Windows, whenever it gets to a
gem whose latest version DOESN'T have Windows binaries, it'll attempt to
build the native extension which will, of course, fail. For example:
Updating sqlite3-ruby
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
c:/ruby/bin/ruby.exe extconf.rb update
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.
The old pre-1.x behavior of asking for the required platform at least made updating possible. Now I can't update at all unless I uninstall the troublesome gems (currently sqlite3-ruby and hpricot), run the update, then re-install the gems using the --version switch.
Does anyone have a solution to this conundrum or are we stuck with it?
Note:
$ gem -v
1.2.0
$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
Note (26 September 2008): I just updated to gems 1.3.0 and this problem persists.
Note (18 November 2008): Just updated to gems 1.3.1 and the problem persists.
Note (28 April 2009): The latest version of Gems (1.3.2) now skips any gems where building of native extensions fails during update; in other words, the problem is fixed. Hooray!
gem update --system only updates RubyGems. gem update will update all installed gems to their latest versions, so it will update Rails to 3.0. 0. in your application folder.
What does gem install do? gem install , in its simplest form, does something kind of like this. It grabs the gem and puts its files into a special directory on your system. You can see where gem install will install your gems if you run gem environment (look for the INSTALLATION DIRECTORY: line):
Description. The cleanup command removes old versions of gems from GEM_HOME that are not required to meet a dependency. If a gem is installed elsewhere in GEM_PATH the cleanup command won't delete it. If no gems are named all gems in GEM_HOME are cleaned.
Gems, as of version 1.3.2, will now skip gems that fail to build, so update Rubygems to the latest version and the problem discussed here should be solved.
gem update --system
The following solution is now deprecated, but I leave it here for the record.
I started a thread on this issue on the Ruby Forum (it's a front end to the mailing list). There's some interesting discussion; it's worth a read. There's even a very hacky solution to this problem on there:
`gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z| `gem.bat update #{z}`}
It calls the gem outdated
command and builds a list of all of the outdated gems. It then iterates over the list and calls gem update
for each individual outdated gem. If one fails, it just moves onto the next.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With