# Gem update on Windows is broken?

**URL:** <https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485>\
**Category:** Ruby\
**Created:** [September 25, 2008, 10:23am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485 "2008-09-25T10:23:02Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 25, 2008, 10:23am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/1 "2008-09-25T10:23:02Z")

</div>

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 extention 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 behaviour 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 know of a way to get the update command working again on  
Windows or am I stuck?

Many thanks,  
Charles

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 25, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/2 "2008-09-25T21:28:23Z")

</div>

On Sep 25, 2008, at 01:22 AM, Charles R. wrote:

> 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.

There is no pre-built sqlite3-ruby for any platform.

[http://rubyforge.org/frs/?group\_id=254&release\_id=25302](http://rubyforge.org/frs/?group_id=254&release_id=25302)

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 8:09am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/3 "2008-09-26T08:09:46Z")

</div>

Eric H. wrote:

> On Sep 25, 2008, at 01:22 AM, Charles R. wrote:
> 
> > 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.
> 
> There is no pre-built sqlite3-ruby for any platform.
> 
> [http://rubyforge.org/frs/?group\_id=254&release\_id=25302](http://rubyforge.org/frs/?group_id=254&release_id=25302)

Yes, and has been posted about previously (without any replies), not  
having a pre-built sqlite3-ruby causes “gem update” to fail on Windows  
systems, preventing other gems to be updated.

Is there a way to tell gem update to either skip that one gem , or  
continue updating the rest of the gems?? Until there’s a win32 built  
version of sqlite3-ruby, this will be causing problems.

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 3:02pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/4 "2008-09-26T15:02:33Z")

</div>

Charles R. wrote:

> Yes, I would suggest a few solutions:
> 
> - Add some logic to gem update that looks for the platform and tests to  
> see if the lastest version of a given gem is compatible with that  
> platform. If it isn’t, drop back a version until a compatible version is  
> found.
> 
> - When a gem fails to update, don’t kill the whole update; just skip the  
> gem that wouldn’t update.
> 
> - Allow for an option to be supplied to gem update that skips supplied  
> gems. E.g., gem update --skip sqlite3-ruby hpricot
> 
> Charles

Amen. I second this!

Now, eventmachine is killing gem update. I’m getting a compile error.  
(Granted this could just be a bug in the eventmachine code, but  
still…)

em.cpp  
em.cpp(1193) : error C2374: ‘i’ : redefinition; multiple initialization  
em.cpp(1186) : see declaration of ‘i’  
NMAKE : fatal error U1077: ‘cl’ : return code ‘0x2’  
Stop.

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 8:57am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/5 "2008-09-26T08:57:28Z")

</div>

John T. wrote:

> Eric H. wrote:
> 
> > There is no pre-built sqlite3-ruby for any platform.
> > 
> > [http://rubyforge.org/frs/?group\_id=254&release\_id=25302](http://rubyforge.org/frs/?group_id=254&release_id=25302)
> 
> Yes, and has been posted about previously (without any replies), not  
> having a pre-built sqlite3-ruby causes “gem update” to fail on Windows  
> systems, preventing other gems to be updated.

Yes, this is correct.

Previous versions of sqlite3-ruby had win32 versions (e.g.  
sqlite3-ruby-1.2.3-mswin32.gem) and these installed fine. If I issue the  
following command, the sqlite3-ruby gem installs just fine:

$ gem install sqlite3-ruby --version 1.2.3  
Successfully installed sqlite3-ruby-1.2.3-x86-mswin32  
1 gem installed  
Installing ri documentation for sqlite3-ruby-1.2.3-x86-mswin32…  
Installing RDoc documentation for sqlite3-ruby-1.2.3-x86-mswin32…

The problem then comes when I run gem update: gems fails to recognise  
that the lastest sqlite3-ruby gem does not have a win32 version. It  
tries to install the latest, incompatible, version, and fails. The whole  
gem update process then stops, thus making a complete update of all gems  
impossible.

I should also point out that this issue isn’t specific to the  
sqlite3-ruby gem; the hpricot gem also triggers this problem.

> Is there a way to tell gem update to either skip that one gem , or  
> continue updating the rest of the gems?? Until there’s a win32 built  
> version of sqlite3-ruby, this will be causing problems.

Yes, I would suggest a few solutions:

- Add some logic to gem update that looks for the platform and tests to  
see if the lastest version of a given gem is compatible with that  
platform. If it isn’t, drop back a version until a compatible version is  
found.

- When a gem fails to update, don’t kill the whole update; just skip the  
gem that wouldn’t update.

- Allow for an option to be supplied to gem update that skips supplied  
gems. E.g., gem update --skip sqlite3-ruby hpricot

Charles

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 4:18pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/6 "2008-09-26T16:18:55Z")

</div>

Charles R. wrote:

> John T. wrote:
> 
> > Now, eventmachine is killing gem update. I’m getting a compile error.  
> > (Granted this could just be a bug in the eventmachine code, but  
> > still…)
> 
> Same here, although I don’t have nmake installed and thus I’m getting  
> the same old failed to build native extension error:

This machine has installed:

Microsoft Visual Studio 6.0  
" Visual Studio 2003  
" Visual Studio 2005  
" Visual Studio 2008

And no combination of command lines will get the gems to compile, so I  
have no idea how to get it to work. (Any version later than 2003 will  
bomb with errors about compiler switches that have been deprecated …  
if it’s not one thing…)

Thankfully this is just my work Winders box, and most of my real  
Rail/Ruby playing is done on OS X 🙂 It just works.

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/7 "2008-09-26T22:23:52Z")

</div>

> Yes, I would suggest a few solutions:
> 
> - Add some logic to gem update that looks for the platform and tests to  
> see if the lastest version of a given gem is compatible with that  
> platform. If it isn’t, drop back a version until a compatible version is  
> found.
> 
> - When a gem fails to update, don’t kill the whole update; just skip the  
> gem that wouldn’t update.
> 
> - Allow for an option to be supplied to gem update that skips supplied  
> gems. E.g., gem update --skip sqlite3-ruby hpricot

You could also try mingw ruby:

> **[Still playing with Ruby on Windows | AkitaOnRails.com](https://www.akitaonrails.com/2008/7/26/still-playing-with-ruby-on-windows)**
>
> Leitores brasileiros: cliquem aqui
> A week ago I’ve tested the newest One-Click Ruby Installer build and found a few minor glitches. Since then I’ve...

A little edgey, but hey 🙂

Cheers.  
-=R

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 26, 2008, 4:09pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/8 "2008-09-26T16:09:22Z")

</div>

John T. wrote:

> Now, eventmachine is killing gem update. I’m getting a compile error.  
> (Granted this could just be a bug in the eventmachine code, but  
> still…)

Same here, although I don’t have nmake installed and thus I’m getting  
the same old failed to build native extension error:

$ gem update  
Updating installed gems  
Updating eventmachine  
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 windows.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  
–srcdir=.  
–curdir  
–ruby=c:/ruby/bin/ruby

Gem files will remain installed in  
c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.2 for inspection.  
Results logged to  
c:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.12.2/ext/gem\_make.out

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 11:12am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/9 "2008-09-27T11:12:24Z")

</div>

Roger P. wrote:

> You could also try mingw ruby:  
> [Still playing with Ruby on Windows | AkitaOnRails.com](http://www.akitaonrails.com/2008/7/26/still-playing-with-ruby-on-windows)
> 
> A little edgey, but hey 🙂

Cool, thanks. I had no idea the new mingw version had come so far.  
Where’s the best place to track progress on it?

Do you think now is the time to switch or does it still feel a little  
_too_ edgey? If it’s usable, but could do with testing help, I’d be more  
that happy to help with that effort.

As a side note, it’s good to see you’re using E Text Editor. Awesome  
editor, eh? Did you see the new snippet pipes feature that was recently  
rolled in? Here’s a post I made about it to the CSS Discuss list with a  
bunch of screencasts:

[http://archivist.incutio.com/viewlist/css-discuss/101947](http://archivist.incutio.com/viewlist/css-discuss/101947)

Charles

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/10 "2008-09-27T18:30:25Z")

</div>

On Fri, Sep 26, 2008 at 2:09 AM, John T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a way to tell gem update to either skip that one gem , or  
> continue updating the rest of the gems??

`gem outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.map{|z|system(“gem  
update #{z}”)}

😉

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 6:45pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/11 "2008-09-27T18:45:41Z")

</div>

On Sep 27, 7:11 am, Charles R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> _too_ edgey? If it’s usable, but could do with testing help, I’d be more  
> that happy to help with that effort.

OCI based on MinGW even is edgy I use on a daily basis, but be warned:

You will require install what we call the development kit, which is  
MinGW (GCC) and, as any \*nix OS, you will require the libraries and  
the headers for the extensions that depend on externals, like SQLite3  
or MySQL.

Last time I tried to build sqlite3-ruby for MinGW (or even VC6) had a  
lot of troubles (and didn’t find time to play again).

MySQL, on the other hand, has binaries, also win32console:

gem list --source [http://gems.rubyinstaller.org](http://gems.rubyinstaller.org)

> As a side note, it’s good to see you’re using E Text Editor. Awesome  
> editor, eh? Did you see the new snippet pipes feature that was recently  
> rolled in? Here’s a post I made about it to the CSS Discuss list with a  
> bunch of screencasts:
> 
> [http://archivist.incutio.com/viewlist/css-discuss/101947](http://archivist.incutio.com/viewlist/css-discuss/101947)

I use Intype, E-Text is too much clone of TextMate 😛

😃

Regards,

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 7:37pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/12 "2008-09-27T19:37:04Z")

</div>

> OCI based on MinGW even is edgy I use on a daily basis, but be warned:
> 
> You will require install what we call the development kit, which is  
> MinGW (GCC) and, as any \*nix OS, you will require the libraries and  
> the headers for the extensions that depend on externals, like SQLite3  
> or MySQL.
> 
> Last time I tried to build sqlite3-ruby for MinGW (or even VC6) had a  
> lot of troubles (and didn’t find time to play again).
> 
> MySQL, on the other hand, has binaries, also win32console:
> 
> gem list --source [http://gems.rubyinstaller.org](http://gems.rubyinstaller.org)

Wow nice! Rmagick et al. Go OCI team. mingw’s looking better every day.  
Note that sqlite3 appears to have [?] mingw binaries [1]

-=R  
[1] [Buckblog: SQLite3-Ruby 1.2.3](http://weblog.jamisbuck.org/2008/8/27/sqlite3-ruby-1-2-3)

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 5:02pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/13 "2008-09-27T17:02:06Z")

</div>

> Cool, thanks. I had no idea the new mingw version had come so far.  
> Where’s the best place to track progress on it?
> 
> Do you think now is the time to switch or does it still feel a little  
> _too_ edgey? If it’s usable, but could do with testing help, I’d be more  
> that happy to help with that effort.

> As a side note, it’s good to see you’re using E Text Editor. Awesome  
> editor, eh? Did you see the new snippet pipes feature that was recently  
> rolled in? Here’s a post I made about it to the CSS Discuss list with a  
> bunch of screencasts:

Well I can’t take much credit–I wasn’t actually the blog author 🙂

The only concern I have with mingw is that some binary extensions aren’t  
available in a pre-built binary for mingw yet [sqlite, mysql, rmagick]  
so you have to install them with --platform=mswin32 which is…a little  
unstable. Other than that I’m sure the OCI guys would love some extra  
testers and I’ve used it with success 🙂

You could track progress on the OCI mailing list and/or at  
[http://github.com/luislavena/rubyinstaller/tree/master](http://github.com/luislavena/rubyinstaller/tree/master) I believe.

Last I heard they were attempting to bundle it with an updated version  
of OpenSSL or what not.

Good luck.  
-=R

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [September 27, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/14 "2008-09-27T23:19:25Z")

</div>

unknown wrote:

> `gem outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.map{|z|system(“gem  
> update #{z}”)}

That didn’t quite work, but this did:

`gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z|  
`gem.bat update #{z}`}

Thanks mysterious unknown person. 🙂

Luis, thank you for the insights, I will give the mingw version a try.

> I use Intype, E-Text is too much clone of TextMate 😛

You don’t like TextMate? That’s just crazy talk. 😛 Seriously though,  
the Intype developers sure do take a long time to get things done,  
whereas E Text Editor’s author, Alexander Stigsen, is a coding machine.  
He usually pushes out a release once a week. I do have a look at Intype  
every so often though. It’s not bad.

Charles

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [December 11, 2008, 11:25am UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/15 "2008-12-11T11:25:43Z")

</div>

Charles R. wrote:

> That didn’t quite work, but this did:
> 
> `gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z|  
> `gem.bat update #{z}`}

sorry for being so slow… i am new with all these command line  
how to apply the above code into command line?

thank you  
🙂

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [December 18, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/16 "2008-12-18T12:56:01Z")

</div>

Aditya L. wrote:

> Charles R. wrote:
> 
> > That didn’t quite work, but this did:
> > 
> > `gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z|  
> > `gem.bat update #{z}`}
> 
> sorry for being so slow… i am new with all these command line  
> how to apply the above code into command line?

You need to paste it into a .rb file, then run the .rb file from the  
command line. I’ve attached the file I use. Just stick it in C:\ruby\bin  
(or some other location in your PATH) and then type update\_gems from the  
command line.

Hope that helps.

Charles

---

<div class="post-metadata">

**Author:** ![scrajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@scrajesh](https://www.ruby-forum.com/u/scrajesh)\
**Post date:** [December 18, 2008, 4:12pm UTC](https://www.ruby-forum.com/t/gem-update-on-windows-is-broken/149485/17 "2008-12-18T16:12:50Z")

</div>

Hey  
Many thanks 😃  
will try it now

Charles R. wrote:

> Aditya L. wrote:
> 
> > Charles R. wrote:
> > 
> > > That didn’t quite work, but this did:
> > > 
> > > `gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z|  
> > > `gem.bat update #{z}`}
> > 
> > sorry for being so slow… i am new with all these command line  
> > how to apply the above code into command line?
> 
> You need to paste it into a .rb file, then run the .rb file from the  
> command line. I’ve attached the file I use. Just stick it in C:\ruby\bin  
> (or some other location in your PATH) and then type update\_gems from the  
> command line.
> 
> Hope that helps.
> 
> Charles
