I had to install XML::Parser CPAN module to parse some of the xml files. But I was getting “requires expat.h” error while installing it. In short, XML::Parser is the module for parsing XML documents.
I am using Ubuntu 14.10 and below is the snippet of error that I got.
[bash]
chmod 644 Expat.bs
/usr/bin/perl /usr/share/perl/5.20.2/ExtUtils/xsubpp -noprototypes -typemap /usr/share/perl/5.20/ExtUtils/typemap -typemap typemap Expat.xs > Expat.xsc && mv Expat.xsc Expat.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"2.44\" -DXS_VERSION=\"2.44\" -fPIC "-I/usr/lib/x86_64-linux-gnu/perl/5.20/CORE" Expat.c
Expat.xs:12:19: fatal error: expat.h: No such file or directory
#include <expat.h>
^
compilation terminated.
Makefile:317: recipe for target ‘Expat.o’ failed
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory ‘/home/sanjeev/.cpan/build/XML-Parser-2.44-8nA0zK/Expat’
Makefile:592: recipe for target ‘subdirs’ failed
make: *** [subdirs] Error 2
TODDR/XML-Parser-2.44.tar.gz
/usr/bin/make — NOT OK
[/bash]
Install expat manually
- Install expat by downloading it from http://sourceforge.net/projects/expat/
- Extract tar file i.e. tar -xvzf expat-2.1.0.tar.gz
- cd expat-2.1.0
- run executable ‘configure’ file in terminal i.e.
[bash]./configure[/bash]
- run make command in terminal i.e.
[bash]make[/bash]
- then
[bash]make install[/bash]
Now install XML::Parser from CPAN
You can use any CPAN installation methods. I prefer using cpanm command i.e.
[bash]sudo cpanm XML::Parser[/bash]
[bash]
sudo cpanm XML::Parser
–> Working on XML::Parser
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz … OK
Configuring XML-Parser-2.44 … OK
Building and testing XML-Parser-2.44 … OK
Successfully installed XML-Parser-2.44
1 distribution installed
[/bash]
Let me know if solves expat.h related issue for you also. Comment if you face any issues for installing XML::Parser.
Visitor Rating: 5 Stars