Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install XML::Parser without expat-devel?

XML::Parser fails to build on a quite fresh 64-bit Debian box. After issuing cpan XML::Parser, cpan fails with lots of errors about Expat.c and Expat.xs:

[...]
Expat.xs:2182: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2904: error: ‘XML_Parser’ undeclared (first use in this function)
Expat.c:2904: error: expected ‘;’ before ‘parser’
Expat.xs:2194: error: ‘parser’ undeclared (first use in this function)
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.41-rpV6ok/Expat'
make: *** [subdirs] Error 2
  TODDR/XML-Parser-2.41.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible

Message at the start of the output explains that expat-devel is needed for building.

Expat must be installed prior to building XML::Parser and I can't find it in the standard library directories. Install 'expat-devel' package with your OS package manager. See 'README'.

But expat-devel is not in Debian repository.

Is it possible to get over this without need to build/install expat from source?

like image 521
Alois Mahdal Avatar asked Mar 13 '12 22:03

Alois Mahdal


3 Answers

The package you want to install is named libexpat1-dev. You could also just install libxml-parser-perl via apt-get. Or if you really want to install via CPAN try installing the Debian packages dependencies first via apt-get build-dep libxml-parser-perl.

like image 182
Sebastian Stumpf Avatar answered Oct 22 '22 05:10

Sebastian Stumpf


libexpat1-dev contains both libexpat and expat.h, which are both mentioned in the message as well:

If expat is installed, but in a non-standard directory, then use the following options to Makefile.PL:

EXPATLIBPATH=... To set the directory in which to find libexpat

EXPATINCPATH=... To set the directory in which to find expat.h

Installing libexpat1-dev seems to solve the problem:

$ aptitude install libexpat1-dev
like image 9
Alois Mahdal Avatar answered Oct 22 '22 05:10

Alois Mahdal


There is always the manual method - to build/install expat from source. (This example shows installing to an alternative location for XAMPP | LAMPP)

Download from: http://sourceforge.net/projects/expat/files/expat/

tar zxf /[where-ever]/expat-2.1.0.tar.gz -C /tmp
cd /tmp/expat-2.1.0
/opt/lampp/bin/perl ./configure --prefix=/opt/lampp LDFLAGS=-L/opt/lampp/lib 
make
make install

http://search.cpan.org - search for and download - XML::Parser

tar zxf /[where-ever]/XML-Parser-2.41.tar.gz -C /tmp
cd /tmp/XML-Parser-2.41
/opt/lampp/bin/perl ./Makefile.PL EXPATLIBPATH=/opt/lampp/lib EXPATINCPATH=/opt/lampp/include
make
make test
make install
like image 5
LadyBuzz Avatar answered Oct 22 '22 03:10

LadyBuzz