Can't install Nokogiri gem, "libxml/parser.h" not found, but its there, why?

Manuel Görlich picture Manuel Görlich · Mar 6, 2012 · Viewed 9.3k times · Source

I tried to install Nokogiri but I always get an compiling error:

checking for libxml/parser.h... *** extconf.rb failed ***

but, I've installed it and all other dependencies.

I try to give the installer hints like this:

%> gem install nokogiri -- --with-xml2-lib=/usr/lib/ --with-xml2-include=/usr/include/libxml2/

...

checking for libxml/parser.h... *** extconf.rb failed ***

...

but it still doesn't install:

%> find /usr/include/ -name "parser.h"    
/usr/include/libxml2/libxml/parser.h
...

I'm on Ubuntu 11.10.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Output of:

"dpkg-query -l | grep xml" and "dpkg-query -l | grep xslt"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The failure seem to be on the side of GCC:

%> cat hello.c
#include <stdio.h>

main()
{
   printf("Hello World \n");
}

%> gcc hello.c
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
collect2: ld gab 1 als Ende-Status zurück

Answer

earlonrails picture earlonrails · Sep 11, 2012

This will work.

sudo apt-get install libxslt-dev libxml2-dev
gem install nokogiri