# Can't find libxml-ruby gem

**URL:** <https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809>\
**Category:** ruby-talk\
**Created:** [28 December 2009 21:33 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809 "2009-12-28T21:33:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Alta](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@Peter\_Alta](https://rubytalk.org/u/Peter_Alta)\
**Post date:** [28 December 2009 21:33 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809/1 "2009-12-28T21:33:37Z")

</div>

I am unable to find a libxml-ruby gem.  
I've pasted some diagnostic info below.  
Could someone please point me in the right direction?  
Thank you.

C:\\>irb  
irb(main):001:0\> require 'libxml-ruby'  
LoadError: no such file to load -- libxml-ruby  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from C:/Program  
Files/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem\_original\_require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from C:/Program  
Files/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require'  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):1  
irb(main):002:0\> exit

C:\\>gem install -r libxml-ruby  
ERROR: While executing gem ... (Gem::GemNotFoundException)  
&nbsp;&nbsp;&nbsp;&nbsp;Could not find libxml-ruby (\> 0) in any repository

C:\\>gem sources  
\*\*\* CURRENT SOURCES \*\*\*

[http://gems.rubyforge.org](http://gems.rubyforge.org)  
[http://gems.github.com](http://gems.github.com)

C:\\>gem -v  
0.9.4

C:\\>ruby -v  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Phillip\_Gawlowski1](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Phillip\_Gawlowski1](https://rubytalk.org/u/Phillip_Gawlowski1)\
**Post date:** [28 December 2009 21:49 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809/2 "2009-12-28T21:49:58Z")

</div>

> I am unable to find a libxml-ruby gem.  
> I've pasted some diagnostic info below.

> C:\\>gem sources  
> \*\*\* CURRENT SOURCES \*\*\*
> 
> [http://gems.rubyforge.org](http://gems.rubyforge.org)  
> [http://gems.github.com](http://gems.github.com)

gems.github.com is defunct 😉

> C:\\>gem -v  
> 0.9.4

RubyGems is at 1.3.5 by now, which you'll need for

> C:\\>ruby -v  
> ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

PS C:\Users\CynicalRyan\> ruby -v  
ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

You will need the devkit, and have to go header-file hunting.

You can get a MinGW build of Ruby + devkit at RubyInstaller.org.  
RubyGems at RubyGems.org

> **···**
>
> On 28.12.2009 22:33, Peter Alta wrote:
> 
> --  
> Phillip Gawlowski

---

<div class="post-metadata">

**Author:** ![Peter\_Alta](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@Peter\_Alta](https://rubytalk.org/u/Peter_Alta)\
**Post date:** [28 December 2009 22:31 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809/3 "2009-12-28T22:31:57Z")

</div>

Phillip Gawlowski wrote:

> You can get a MinGW build of Ruby + devkit at RubyInstaller.org.  
> RubyGems at RubyGems.org

Thank you. That was a helpful start. I updated to  
RubyGems 1.3.5 and installed the MingGW build with  
no apparent problem.

> You will need the devkit, and have to go header-file hunting.

What is "header-file hunting"?  
I don't even know where to begin.  
Is installing libxml-ruby beyond the scope  
of a non-C programmer?

Here is what I get from gem now:

> **···**
>
> ----------------------------------------------------------------------  
> C:\\>gem install -r libxml-ruby  
> Building native extensions. This could take a while...  
> ERROR: Error installing libxml-ruby:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension.
> 
> 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.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.  
> ----------------------------------------------------------------------
> 
> I'm a little confused by "You may need configuration  
> options." Is that meant for the "gem" command? Or for  
> the extconf.rb that gem is apparently running?
> 
> Any hints on what to do next?
> 
> Thanks much.  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Phillip\_Gawlowski1](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@Phillip\_Gawlowski1](https://rubytalk.org/u/Phillip_Gawlowski1)\
**Post date:** [28 December 2009 22:51 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809/4 "2009-12-28T22:51:02Z")

</div>

> What is "header-file hunting"?

Finding all the header-files the compiler (NOT the gem command, but the compiler the devkit provides!) needs to be able to build a program or a library.

> I don't even know where to begin.  
> Is installing libxml-ruby beyond the scope  
> of a non-C programmer?

On Windows? Probably. Very likely, in fact.

> Here is what I get from gem now:
> 
> ----------------------------------------------------------------------  
> C:\\>gem install -r libxml-ruby  
> Building native extensions. This could take a while...  
> ERROR: Error installing libxml-ruby:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ERROR: Failed to build gem native extension.
> 
> 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.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.  
> ----------------------------------------------------------------------
> 
> I'm a little confused by "You may need configuration  
> options." Is that meant for the "gem" command? Or for  
> the extconf.rb that gem is apparently running?

Neither. It's for the C-Compiler.

> Any hints on what to do next?

Use Nokogiri (nokogiri.org). 😉

Or, if you must use libxml, set up a virtual machine with Linux, and use that (which brings its own set of difficulties. virtualbox.org is a good start to get going with virtualization).

The Devkit requires you to be either lucky, or to be at least well-versed enough in working with compilers, to fix the issues the configuration step throws at you. It's best if you are seasoned-enough C-Programmer to dig into the actual C code to fix bugs, and produce a build that can be distributed for Windows.

What you can do, is log a bug with the libxml-ruby team, and lobby them to provide a MinGW32 compatible build.

> **···**
>
> On 28.12.2009 23:31, Peter Alta wrote:
> 
> --  
> Phillip Gawlowski

---

<div class="post-metadata">

**Author:** ![Tim\_Ferrell](https://avatars.discourse-cdn.com/v4/letter/t/ea666f/32.png) [@Tim\_Ferrell](https://rubytalk.org/u/Tim_Ferrell)\
**Post date:** [26 January 2010 21:22 UTC](https://rubytalk.org/t/cant-find-libxml-ruby-gem/56809/5 "2010-01-26T21:22:52Z")

</div>

Phillip Gawlowski wrote:

> > What is "header-file hunting"?
> 
> Finding all the header-files the compiler (NOT the gem command, but the  
> compiler the devkit provides!) needs to be able to build a program or a  
> library.

I was able to get this gem to build on Windows (Win7 x64 to be precise)  
by downloading the MinGW-based oneclick installer (RC1 as of now) and  
the devkit that accompanies it and installing them... I then found the  
necessary headers and libs needed to get the libxml-ruby gem to build  
and packaged them up:

&nbsp;&nbsp;[http://www.mcgeecorp.com/downloads/win-install-libxml-ruby.zip](http://www.mcgeecorp.com/downloads/win-install-libxml-ruby.zip) ~760kb

Just unzip and run the ruby install script to build...

Note: the script assumes you installed Ruby to C:\Ruby ... you can also  
pass an alternate install dir to the script:

&nbsp;&nbsp;C:\Ruby19\bin\ruby install\_libxml\_gem.rb C:/Ruby19

HTH,  
Tim

> **···**
>
> > On 28.12.2009 23:31, Peter Alta wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
