4

When trying to install the ruby gem libxml-ruby on my windows computer I get the following error message

D:/.../bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... no
 extconf failure: need zlib

Can someone tell me how to install this gem? I googled for answers and also found the zlib libraries but don't know where to use them.

I am using ruby version 1.8.7 with devkit 4.5.1

MY SOLUTION

  1. Copied the zlib1.dll from the ruby/bin folder to the ruby/lib folder
  2. downloaded the iconv.dll from ftp://ftp.zlatkovic.com/libxml/ and put it also in the ruby/lib folder
  3. downloaded the libxml2 from ftp://ftp.zlatkovic.com/libxml/ and put the libxml-folder from the include folder in the devkit include directory for mingw (in my case sth. like devkit/mingw/mingw32/include)
Sebastian Müller
  • 5,471
  • 13
  • 51
  • 79
  • 2
    Unless you really need libxml for something, I would substitute it with Nokogiri, it is the best XML gem right now. – Michael Papile Mar 18 '11 at 15:30
  • yes I need it in order to get third party code run – Sebastian Müller Mar 18 '11 at 16:42
  • [Getting binaries from here](http://www.zlatkovic.com/libxml.en.html) help? – Zabba Mar 21 '11 at 12:02
  • One frequent cause of this type of issue is that the zlib you have is not using the same architecure as your ruby... If ruby is 64 bits, you'll need a 64-bits zlib, if it's x32, then you'll need both x32. Also, ensure your zlib.ddl is in your path. – Romain Mar 21 '11 at 12:59
  • in which path? where to find a 64bit zlib? it seems to me that there is only one version to find at http://zlib.net/ – Sebastian Müller Mar 21 '11 at 13:44
  • I have the same problem as you running windows 7 64 bit. I have tried looking into compiling a 64bit version of the included zlib without success. The VS project file is broken and trying to install with devkit make is giving me `missing ruby.h` (something like that). I am talking about this directory `C:\Ruby187\lib\ruby\gems\1.8\gems\libxml-ruby-1.1.4\ext` – bluekeys Mar 21 '11 at 15:03

2 Answers2

0

Check that you have the zlib headers installed. On many linux distros this is a package named "zlib-devel".

Edit: I just realized you are using a Windows environment. I don't have any development experience with Windows, but your going to need the zlib.h somewhere on your include path. My guess is that you only have the .dll file, which would allow already compiled programs to use zlib but wouldn't allow you to compile any source code that references it.

Oscar Korz
  • 2,457
  • 1
  • 18
  • 18
0

I found development headers for windows98/NT/2000/XP/2003 on this page linked from zlib.net

You need that if you want to use zlib in your programs. Officially, zlib does not have a "programmers manual", but a quick read to zlib.h will make your ideas clearer.

Brett Bender
  • 19,388
  • 2
  • 38
  • 46
  • I think this is a relatively good answer but I just found out how to install it =) with the help of some ruby google groups. I will post the solution when I have time. – Sebastian Müller Mar 23 '11 at 13:20
  • @Xelluloid - do you have time yet:-) I'd really like to know if there is a simpler solution. – MZB Sep 17 '13 at 04:11