Jul 17

I was trying to install ruby-xslt on my Ubuntu laptop after I installed on my Mac. When I do a sudo gem install ruby-xslt, I got the following:

gem install ruby-xsltBuilding native extensions.  This could take a while...

ERROR:  Error installing ruby-xslt:

ERROR: Failed to build gem native extension./usr/local/bin/ruby extconf.rb install ruby-xslt

checking for xmlParseDoc() in -lxml2... yes

checking for xsltParseStylesheetFile() in -lxslt... no

checking for exsltRegisterAll() in -lexslt... no

extconf.rb:4: command not found: xslt-config --cflags

creating extconf.h

creating Makefile

/usr/local/lib/ruby/1.8/mkmf.rb:1102: warning: global variable `$preload' not initialized


gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\"  -fPIC -g -Wall -I/usr/include/libxml2  -g -O2 -DUSE_ERROR_HANDLER -DUSE_EXSLT  -c xslt_lib.c

In file included from xslt_lib.c:19:

xslt.h:36:27: error: libxslt/extra.h: No such file or directory

xslt.h:37:26: error: libxslt/xslt.h: No such file or directory

xslt.h:38:35: error: libxslt/xsltInternals.h: No such file or directory

xslt.h:39:31: error: libxslt/transform.h: No such file or directory

xslt.h:40:31: error: libxslt/xsltutils.h: No such file or directory

xslt.h:41:29: error: libxslt/imports.h: No such file or directory

xslt.h:44:30: error: libexslt/exslt.h: No such file or directory

After I do some Googling, here is the solution:

sudo apt-get install libxml-ruby1.8 libxslt1-dev
sudo gem install ruby-xslt

That is it!

3 Responses

  1. Ruby and Rails » Blog Archive » libxslt Problems When Installing the Mechanize Gem Says:

    [...] after some Googling i found this post on Industry Zero and resolved the issue with a simple package installation: io@crazo:~$ sudo apt-get install [...]

  2. Recent Faves Tagged With "exslt" : MyNetFaves Says:

    [...] public links >> exslt How to install ruby-xslt on Ubuntu First saved by LioneATcakE | 9 days ago Teaching XSLT new tricks with EXSLT First saved by [...]

  3. Harish Reddy Says:

    Thanks Heaps