# CentOS gem install of libxml-ruby is failing

**URL:** <https://www.ruby-forum.com/t/centos-gem-install-of-libxml-ruby-is-failing/133040>\
**Category:** Ruby\
**Created:** [March 26, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/centos-gem-install-of-libxml-ruby-is-failing/133040 "2008-03-26T23:27:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [March 26, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/centos-gem-install-of-libxml-ruby-is-failing/133040/1 "2008-03-26T23:27:09Z")

</div>

I’m trying to do a simple gem install so I can validate some XML files  
for a project, and the gem install fails as follows on my CentOS system:

[root@miller ~]# uname -a  
Linux miller 2.6.18-53.1.4.el5 #1 SMP Fri Nov 30 00:45:16 EST 2007 i686  
athlon i386 GNU/Linux  
[root@miller ~]# gem install libxml-ruby  
Building native extensions. This could take a while…  
ERROR: Error installing libxml-ruby:  
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install libxml-ruby  
checking for socket() in -lsocket… no  
checking for gethostbyname() in -lnsl… yes  
checking for atan() in -lm… no  
checking for atan() in -lm… yes  
checking for inflate() in -lz… yes  
checking for iconv\_open() in -liconv… no  
checking for libiconv\_open() in -liconv… no  
checking for libiconv\_open() in -llibiconv… no  
checking for iconv\_open() in -llibiconv… no  
checking for iconv\_open() in -lc… yes  
checking for xmlParseDoc() in -lxml2… no  
checking for xmlParseDoc() in -llibxml2… no  
checking for /opt/lib() in -lxml2… 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=/usr/bin/ruby  
–with-iconv-dir  
–without-iconv-dir  
–with-iconv-include  
–without-iconv-include=${iconv-dir}/include  
–with-iconv-lib  
–without-iconv-lib=${iconv-dir}/lib  
–with-xml2-dir  
–without-xml2-dir  
–with-xml2-include  
–without-xml2-include=${xml2-dir}/include  
–with-xml2-lib  
–without-xml2-lib=${xml2-dir}/lib  
–with-zlib-dir  
–without-zlib-dir  
–with-zlib-include  
–without-zlib-include=${zlib-dir}/include  
–with-zlib-lib  
–without-zlib-lib=${zlib-dir}/lib  
–with-socketlib  
–without-socketlib  
–with-nsllib  
–without-nsllib  
–with-mlib  
–without-mlib  
–with-mlib  
–without-mlib  
–with-zlib  
–without-zlib  
–with-iconvlib  
–without-iconvlib  
–with-iconvlib  
–without-iconvlib  
–with-libiconvlib  
–without-libiconvlib  
–with-libiconvlib  
–without-libiconvlib  
–with-clib  
–without-clib  
–with-xml2lib  
–without-xml2lib  
–with-libxml2lib  
–without-libxml2lib  
–with-xml2lib  
–without-xml2lib  
extconf failure: need libxml2.

```
   Install the library or try one of the following options to

```

extconf.rb:

```
     --with-xml2-dir=/path/to/libxml2
     --with-xml2-lib=/path/to/libxml2/lib
     --with-xml2-include=/path/to/libxml2/include

```

Gem files will remain installed in  
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.5.4 for inspection.  
Results logged to  
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.5.4/ext/libxml/gem\_make.out  
—snip—  
The only so I seem to have is:

/usr/lib/libxml2.so.2.6.26

Presumably there should be a symbolic link or something, but whatever is  
missing,…If I go ln -s /usr/lib/libxml2.so.2.6.26 /usr/lib/libxml2.so,  
then…  
Nope, it fails the same way…  
I also tried:

Gem files will remain installed in  
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.5.4 for inspection.  
Results logged to  
/usr/lib/ruby/gems/1.8/gems/libxml-ruby-0.5.4/ext/libxml/gem\_make.out  
[root@miller ~]# gem install --with-xml2-dir=/usr/lib libxml-ruby  
ERROR: While executing gem … (OptionParser::InvalidOption)  
invalid option: --with-xml2-dir=/usr/lib  
[root@miller ~]# gem install libxml-ruby --with-xml2-dir=/usr/lib  
ERROR: While executing gem … (OptionParser::InvalidOption)  
invalid option: --with-xml2-dir=/usr/lib  
[root@miller ~]# gem --with-xml2-dir=/usr/libinstall libxml-ruby  
ERROR: Invalid option: --with-xml2-dir=/usr/libinstall. See ‘gem  
–help’.  
[root@miller ~]# gem --with-xml2-dir=/usr/lib install libxml-ruby  
ERROR: Invalid option: --with-xml2-dir=/usr/lib. See ‘gem --help’.  
[root@miller ~]#  
----snip----  
xc

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [March 27, 2008, 12:38am UTC](https://www.ruby-forum.com/t/centos-gem-install-of-libxml-ruby-is-failing/133040/2 "2008-03-27T00:38:57Z")

</div>

Xeno C. wrote:

> I’m trying to do a simple gem install so I can validate some XML files  
> for a project, and the gem install fails as follows on my CentOS system:

Do you have the libxml development rpm installed?

That’s the first thing I’d check when these errors come up:

---

<div class="post-metadata">

**Author:** ![Xeno\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/958977/32.png) [@Xeno\_C](https://www.ruby-forum.com/u/Xeno_C)\
**Post date:** [March 27, 2008, 12:49am UTC](https://www.ruby-forum.com/t/centos-gem-install-of-libxml-ruby-is-failing/133040/3 "2008-03-27T00:49:30Z")

</div>

Joel VanderWerf wrote:

> 

Thank you. That appears to have been what I needed. I installed  
libxml-devel and then retried the gem and it appears to have finished  
normally, with gem check showing no problems.

xc
