[RubyInstaller] Cannot install zipruby gem (zlib.h missing)

1,849 views
Skip to first unread message

David Stamm

unread,
May 17, 2010, 5:00:20 PM5/17/10
to RubyInstaller
I just installed RubyInstaller's Ruby 1.8.7 on Windows, as well as the
Development Kit. The first gem installation to give me an issue was
zipruby:

C:\>gem install zipruby
Building native extensions. This could take a while...
ERROR: Error installing zipruby:
ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for zlib.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=C:/Ruby/bin/ruby

I am an extreme newbie to building C extensions, so my Googling for
details on the zlib library did not do me much good. Any suggestions
for how to proceed?

--
You received this message because you are subscribed to the Google Groups "RubyInstaller" group.
To post to this group, send email to rubyin...@googlegroups.com.
To unsubscribe from this group, send email to rubyinstalle...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyinstaller?hl=en.

Luis Lavena

unread,
May 17, 2010, 5:09:53 PM5/17/10
to rubyin...@googlegroups.com
On Mon, May 17, 2010 at 6:00 PM, David Stamm <why...@gmail.com> wrote:
> I just installed RubyInstaller's Ruby 1.8.7 on Windows, as well as the
> Development Kit.  The first gem installation to give me an issue was
> zipruby:
>
> C:\>gem install zipruby
> Building native extensions.  This could take a while...
> ERROR:  Error installing zipruby:
>        ERROR: Failed to build gem native extension.
>

You need zlib library and headers.

You can download it 1.2.3, used by RC2 from here:

http://github.com/oneclick/rubyinstaller/downloads

Extract to a folder and provide the lib and include options during the
gem installation:

gem install zipruby -- --with-zlib-include=C:/Path/to/Zlib/include
--with-zlib-lib=C:/Path/to/Zlib/lib

HTH,
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

David Stamm

unread,
May 17, 2010, 5:32:44 PM5/17/10
to RubyInstaller
Thanks for the speedy response! Alas, that did not seem to do the
trick.

I downloaded the 1.2.3 download you linked to, and extracted it into
C:/Ruby/lib/zlib (which I thought was a good place to avoid losing
it). I modified the "gem install" command to reflect the new paths.

I got the exact same error message:
checking for zlib.h... no

Luis Lavena

unread,
May 17, 2010, 5:45:17 PM5/17/10
to rubyin...@googlegroups.com
On Mon, May 17, 2010 at 6:32 PM, David Stamm <why...@gmail.com> wrote:
> Thanks for the speedy response!  Alas, that did not seem to do the
> trick.
>
> I downloaded the 1.2.3 download you linked to, and extracted it into
> C:/Ruby/lib/zlib (which I thought was a good place to avoid losing
> it).  I modified the "gem install" command to reflect the new paths.
>
> I got the exact same error message:
> checking for zlib.h... no
>

Ah, zipruby uses --with-opt as options.

gem install zipruby -- --with-opt-include=... --with-opt-lib=...

However, the problem seems that zlib 1.2.3 do not have the static
(libz) gem zipruby is looking for:

checking for main() in -lz... no
*** extconf.rb failed ***

Going inside lib folder and chaning "zdll.lib" to "libz.a" seems does
the trick... but:

checking for zlib.h... yes
checking for main() in -lz... yes
checking for fseeko()... no
checking for ftello()... no
checking for mkstemp()... no
creating Makefile

make
gcc -I. -I. -IC:/Users/Luis/Tools/Ruby/ruby-1.8.7-p249-i386-mingw32/lib/ruby/1.8/i386-mingw32
-I. -DHAVE_ZLIB_H -IC:/Users/Luis/Projects/_sandbox/zlib/include -g
-O2 -c mkstemp.c
mkstemp.c:51:1: warning: "S_ISDIR" redefined
In file included from mkstemp.c:37:
C:/Users/Luis/Tools/MinGW/gcc/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sys/stat.h:68:1:
warning: this is the location of the previous definition
gcc -I. -I. -IC:/Users/Luis/Tools/Ruby/ruby-1.8.7-p249-i386-mingw32/lib/ruby/1.8/i386-mingw32
-I. -DHAVE_ZLIB_H -IC:/Users/Luis/Projects/_sandbox/zlib/include -g
-O2 -c tmpfile.c
gcc -I. -I. -IC:/Users/Luis/Tools/Ruby/ruby-1.8.7-p249-i386-mingw32/lib/ruby/1.8/i386-mingw32
-I. -DHAVE_ZLIB_H -IC:/Users/Luis/Projects/_sandbox/zlib/include -g
-O2 -c zipruby.c
In file included from zipruby_archive.h:4,
from zipruby.c:7:
zip.h:50: error: conflicting types for 'ssize_t'
C:/Users/Luis/Tools/MinGW/gcc/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sys/types.h:104:
error: previous declaration of 'ssize_t' was here

seems that the zip.h included in zipruby is trying to be so clever and
replace what MinGW is defining.

I can suggest you the following steps:

1) Reach the gem author: http://rubygems.org/gems/zipruby and ask for
native binaries for Windows (RubyInstaller)

2) Propose to him use rake-compiler to ease the burden of
cross-compilation (in case the author is running Linux/OSX)

http://github.com/luislavena/rake-compiler

3) Hack the changes and submit a patch to his project.

Taking in consideration you mention that you're new to Ruby, #3 seems
a bit too complicated.

I would suggest proceed with 1 and 2, and point the gem author to
reach us (RubyInstaller group) and we can provide hints and guidance
on better Windows support.

David Stamm

unread,
May 17, 2010, 5:57:37 PM5/17/10
to rubyin...@googlegroups.com
This gem worked fine on Windows when I installed it using the old
1-click installer. Wouldn't that suggest that a native binary was
involved previously?

I just looked at the ZipRuby project's RubyForge page. There is
"zipruby-0.3.6-x86-mswin32.gem" file available for download.

Is there a way to install this flavor of the gem? A lot of gem
developers have already gone to the trouble of creating Windows
binaries, so this would be a great backup for when native extensions
cannot be built.

Luis Lavena

unread,
May 17, 2010, 6:09:03 PM5/17/10
to rubyin...@googlegroups.com
On Mon, May 17, 2010 at 6:57 PM, David Stamm <why...@gmail.com> wrote:
> This gem worked fine on Windows when I installed it using the old
> 1-click installer.  Wouldn't that suggest that a native binary was
> involved previously?
>

Yes, RubyInstaller uses a different platform 'x86-mingw32', which
differs from original One-Click One.

> I just looked at the ZipRuby project's RubyForge page.  There is
> "zipruby-0.3.6-x86-mswin32.gem" file available for download.
>
> Is there a way to install this flavor of the gem?  A lot of gem
> developers have already gone to the trouble of creating Windows
> binaries, so this would be a great backup for when native extensions
> cannot be built.
>

You can force it providing --platform=mswin32 to the gem installation,
however, I advice against it:

http://blog.mmediasys.com/2008/08/10/rubygems-with-power-comes-responsibility/

There is a chance that other stuff inside the gem do not work.

David Stamm

unread,
May 17, 2010, 6:39:00 PM5/17/10
to RubyInstaller
Thanks for the info about the platform switch (it enabled let me
complete a time-sensitive task) and the warning about misusing it. It
seems I have much to learn about the low-level details of Rubygems and
MinGW. Time to hit the books!

Thanks for all your help, and keep up the good work!


On May 17, 6:09 pm, Luis Lavena <luislav...@gmail.com> wrote:
> On Mon, May 17, 2010 at 6:57 PM, David Stamm <why...@gmail.com> wrote:
> > This gem worked fine on Windows when I installed it using the old
> > 1-click installer.  Wouldn't that suggest that a native binary was
> > involved previously?
>
> Yes, RubyInstaller uses a different platform 'x86-mingw32', which
> differs from original One-Click One.
>
> > I just looked at the ZipRuby project's RubyForge page.  There is
> > "zipruby-0.3.6-x86-mswin32.gem" file available for download.
>
> > Is there a way to install this flavor of the gem?  A lot of gem
> > developers have already gone to the trouble of creating Windows
> > binaries, so this would be a great backup for when native extensions
> > cannot be built.
>
> You can force it providing --platform=mswin32 to the gem installation,
> however, I advice against it:
>
> http://blog.mmediasys.com/2008/08/10/rubygems-with-power-comes-respon...

Luis Lavena

unread,
May 17, 2010, 6:41:12 PM5/17/10
to rubyin...@googlegroups.com
On Mon, May 17, 2010 at 7:39 PM, David Stamm <why...@gmail.com> wrote:
> Thanks for the info about the platform switch (it enabled let me
> complete a time-sensitive task) and the warning about misusing it.  It
> seems I have much to learn about the low-level details of Rubygems and
> MinGW.  Time to hit the books!
>
> Thanks for all your help, and keep up the good work!
>

You're welcome, sorry couldn't offer an out-of-the-box experience.

Please drop a ticket to the gem author so we have a point of reference
to someone else facing the same issue.

Thank you.
Reply all
Reply to author
Forward
0 new messages