# LIBXML and LibXSLT

**URL:** <https://www.ruby-forum.com/t/libxml-and-libxslt/151396>\
**Category:** Rails\
**Created:** [October 20, 2008, 11:30pm UTC](https://www.ruby-forum.com/t/libxml-and-libxslt/151396 "2008-10-20T23:30:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [October 20, 2008, 11:30pm UTC](https://www.ruby-forum.com/t/libxml-and-libxslt/151396/1 "2008-10-20T23:30:22Z")

</div>

Hi,

I installed libxml-ruby and libxslt-ruby. It took a while but it’s  
running now.  
However, on the libxml site ([http://libxml.rubyforge.org/install.xml](http://libxml.rubyforge.org/install.xml)) it  
says:

"…libxml requires a few other libraries to be installed in order to  
build and function properly.

```
* libm (math routines: very standard)
* libz (zlib)
* libiconv
* libxml2

```

…"

And there’s similar stuff on the limxslt-ruby page  
([http://libxsl.rubyforge.org/](http://libxsl.rubyforge.org/))

My question is - is it enough for me to just install the gems (have they  
already been built using the appropriate libraries), or do I have to go  
and find these other libraries? If so can you point me to details on  
where to get them and how to install?

Thanks

Paul

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [October 22, 2008, 3:17pm UTC](https://www.ruby-forum.com/t/libxml-and-libxslt/151396/2 "2008-10-22T15:17:38Z")

</div>

On Oct 20, 5:30 pm, Paul H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> * libm (math routines: very standard)
> 
> ```
> 
> and find these other libraries? If so can you point me to details on  
> where to get them and how to install?

It depends on your OS. Many come with the libraries installed already.  
libxml-ruby is a Ruby binding to the libxml2 library, so it absolutely  
has to be there for things to work. Since you have gotten it to work,  
then you had the libraries already. (Or you’re on Windows, in which  
case the libxml2.dll may have been bundled with the gem)

– Mark.

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [January 24, 2009, 4:54am UTC](https://www.ruby-forum.com/t/libxml-and-libxslt/151396/3 "2009-01-24T04:54:00Z")

</div>

Paul H. wrote:

> Hi,
> 
> I installed libxml-ruby and libxslt-ruby. It took a while but it’s  
> running now.  
> However, on the libxml site ([http://libxml.rubyforge.org/install.xml](http://libxml.rubyforge.org/install.xml)) it  
> says:
> 
> "…libxml requires a few other libraries to be installed in order to  
> build and function properly.
> 
> ```
> * libm (math routines: very standard)
> * libz (zlib)
> * libiconv
> * libxml2
> 
> ```
> 
> …"
> 
> And there’s similar stuff on the limxslt-ruby page  
> ([http://libxsl.rubyforge.org/](http://libxsl.rubyforge.org/))
> 
> My question is - is it enough for me to just install the gems (have they  
> already been built using the appropriate libraries), or do I have to go  
> and find these other libraries? If so can you point me to details on  
> where to get them and how to install?
> 
> Thanks
> 
> Paul

I get these warnings when I install either libxml-ruby or libxslt-ruby:

# gem install libxml-ruby

Building native extensions. This could take a while…  
Successfully installed libxml-ruby-0.9.7  
1 gem installed  
Installing ri documentation for libxml-ruby-0.9.7…

Enclosing class/module ‘mXPath’ for class Expression not known

Enclosing class/module ‘mXPath’ for class Object not known

Enclosing class/module ‘mXPath’ for class Context not known

Enclosing class/module ‘cXMLParser’ for class Context not known  
Installing RDoc documentation for libxml-ruby-0.9.7…

Enclosing class/module ‘mXPath’ for class Expression not known

Enclosing class/module ‘mXPath’ for class Object not known

Enclosing class/module ‘mXPath’ for class Context not known

Enclosing class/module ‘cXMLParser’ for class Context not known

Can I safely ignore them or am I missing a dependency (if so which one?)

---

<div class="post-metadata">

**Author:** ![phudson1442](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c68b51/32.png) [@phudson1442](https://www.ruby-forum.com/u/phudson1442)\
**Post date:** [January 24, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/libxml-and-libxslt/151396/4 "2009-01-24T16:50:46Z")

</div>

Anthony E. wrote:

> Paul H. wrote:

> > My question is - is it enough for me to just install the gems (have they  
> > already been built using the appropriate libraries), or do I have to go  
> > and find these other libraries? If so can you point me to details on  
> > where to get them and how to install?

> Can I safely ignore them or am I missing a dependency (if so which one?)

The answer to both these questions is that .so files, unlike .rb files,  
enjoy  
early binding. If you run an .rb file with missing dependencies, you  
don’t learn  
that until when (or _if_) you hit the require ‘…’ line that pulls them  
in.

However, when .so files (or .dll files) load, the loader itself  
immediately  
finds all the registered dependencies and loads them too. This early  
binding  
happens at the machine language level, so all these libraries can fixup  
their  
addresses to the functions in the libraries they use.

If you can run ruby -e “require ‘libxml’”, and not get any complaints,  
then you  
have enough libxml, because that line forces ruby’s executable image in  
memory  
to then pull in all those .so files!

Also, run all your tests…

–  
Phlip
