0

This is really weird, can someone explain why GCC can not find an include file when installing XML::LibXML?

> cpan PAJAS/XML-LibXML-1.70.tar.gz
...
C:/CPANTE~1/PERL51~1.0_6/site/bin/gcc.exe -c    -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields -O2 -DVERSION=\"1.70\" -DXS_VERSION=\"1.70\"  "-IC:\CPANTesters\Perl5.16.0_64\lib\CORE"  -DHAVE_UTF8 -DHAVE_BLANK LibXML.c
LibXML.xs:34:31: fatal error: libxml/xmlversion.h: No such file or directory

> IF EXIST %INCLUDE%\libxml\xmlversion.h ECHO Cogito ergo sum
Cogito ergo sum

This is ActiveState 5.16.0 64 bit with MinGW64.

I decide to drop using Zlatkovic Win32 binaries ftp://ftp.zlatkovic.com/pub/libxml/, and use the 64 bit binaries available at http://ftp.gnome.org/pub/GNOME/binaries/win64/dependencies/.

The problem above is solved by going to the unpacked module and execute this command:

> perl Makefile.PL INC=-IC:\CPANTesters\bin\gnome-deps-win64\include LIBS=-LC:\CPANTesters\bin\gnome-deps-win64\lib
> dmake 

But problem arises from running dmake test since Perl crashes on all test files.

C:\CPANTesters\Perl5.16.0_64\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/01basic.t ......................... Dubious, test returned 38 (wstat 9728, 0x2600)
Failed 3/3 subtests

Any idea on how to debug this?

nyet
  • 83
  • 1
  • 9

3 Answers3

3

XML-LibXML is a Perl binding for libxml2, but it does not include a copy of libxml2 (of which libxml/xmlversion.h is a part). You must install that separately, and make sure Perl and gcc can find it. INCLUDE is not an environment variable used by gcc. It uses CPATH or C_INCLUDE_PATH.

I contributed instructions for installing XML-LibXML from source on Microsoft Windows. Did you try following them?

The easiest way to get XML-LibXML on Windows is to install Strawberry Perl. It comes with XML-LibXML in the package.

cjm
  • 61,471
  • 9
  • 126
  • 175
  • I have tried using C_INCLUDE_PATH and the error message is gone, but I encountered other problems. Since the title is changed to "Why can't cpan install XML::LibXML?", I'll expand the article to fully reflect the whole experiment. – nyet Sep 21 '12 at 17:58
  • This worked for me on Ubuntu 16.04 by first running `sudo apt-get install libxml2-dev` and when that completed, I was able to run `sudo cpan install XML::LibXML` with success. – Adam T Aug 21 '18 at 13:50
0

Usually, on windows, the easiest thing is to use a repository that has built LibXML for you. This question is similar to yours: Is XML::LibXML not supported on Perl 5.8.8?

Community
  • 1
  • 1
ekawas
  • 6,594
  • 3
  • 27
  • 39
-1

try this, it worked for me on centos 6, after doing this I was able to install via CPANM other modules relying on XML::LibXML https://www.question-defense.com/2010/01/27/perl-cpan-install-xmllibxmlcommon-error-libxml2-not-found

Christian Quirós
  • 494
  • 1
  • 5
  • 9