skip to Main Content

I’m having trouble installing XML::LibXML with cpan on ubuntu 22.04.
I have installed libxml2 and zlib1g. And CPAN reports that it sees libxml2:

# Compiled against libxml2 version: 21303
# Running libxml2 version:          21303

all package requirements are installed. (I can list them if you need to see the version numbers), but all are present)

There are a few warnings. And some tests that failed. But the install itself fails:

Files=77, Tests=2546, 11 wallclock secs ( 0.62 usr  0.14 sys +  9.57 cusr  1.35 csys = 11.68 CPU)
Result: FAIL
Failed 4/77 test programs. 3/2546 subtests failed.
make: *** [Makefile:1327: test_dynamic] Error 255
  SHLOMIF/XML-LibXML-2.0210.tar.gz
  /bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports SHLOMIF/XML-LibXML-2.0210.tar.gz


What I tried was:

cpan XML::LibXML

A couple warnings showed for something depricated:

x86_64-linux-gnu-gcc -c  -I/usr/local/lib/x86_64-linux-gnu/perl/5.34.0/auto/share/dist/Alien-Libxml2/include/libxml2 -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.0210" -DXS_VERSION="2.0210" -fPIC "-I/usr/lib/x86_64
-linux-gnu/perl/5.34/CORE"  -DHAVE_UTF8 perl-libxml-sax.c
perl-libxml-sax.c: In function 'PmmSaxError':
perl-libxml-sax.c:1539:28: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifi
ers]
 1539 |     xmlErrorPtr last_err = xmlCtxtGetLastError( ctxt );
      |     
                   ^~~~~~~~~~~~~~~~~~~

And some tests failed:

t/19die_on_invalid_utf8_rt_58848.t ................. 
#   Failed test 'Parser error.'
#   at t/19die_on_invalid_utf8_rt_58848.t line 19.
#                   'example/thedieline.rss:26: I/O error : Invalid bytes in character encoding
# .com%2fblog%2f2010%2f06%2fginja-d-%25c3%25b3bidos.html&t=Ginja+d%26%2339%3b+
#                                                                                 ^
# example/thedieline.rss:26: parser error : Entity 'ldquo' not defined
# log%2f2010%2f06%2fginja-d-%25c3%25b3bidos.html&t=Ginja+d%26%2339%3b+�“

Test Summary Report
-------------------
t/02parse.t                                      (Wstat: 256 Tests: 533 Failed: 1)
  Failed test:  511
  Non-zero exit status: 1
t/08findnodes.t                                  (Wstat: 256 Tests: 45 Failed: 1)
  Failed test:  14
  Non-zero exit status: 1
t/19die_on_invalid_utf8_rt_58848.t               (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
t/60error_prev_chain.t                           (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 1 tests but ran 0.
Files=77, Tests=2546, 11 wallclock secs ( 0.62 usr  0.14 sys +  9.57 cusr  1.35 csys = 11.68 CPU)
Result: FAIL
Failed 4/77 test programs. 3/2546 subtests failed.
make: *** [Makefile:1327: test_dynamic] Error 255
  SHLOMIF/XML-LibXML-2.0210.tar.gz
  /bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports SHLOMIF/XML-LibXML-2.0210.tar.gz

Any help appreciated – Dean Guenther

2

Answers


  1. Chosen as BEST ANSWER

    Good news, I got it working finally. There are three things I did, and I'm not sure which did the trick:

    1. first of all I found a post somewhere which indicated to do:

    apt install libxml-libxml-perl

    I did this and retried install XML::LibXML and it still failed.

    1. Then I saw another post where somebody had trouple a couple years ago and they ended up updating all ubuntu packages.

    2. Another post said to update all the CPAN packages.

    Between these three, I now was able to get XML::LibXML to build. - dean


  2. If you try to install XML::LibXML from CPAN and don’t have libxml2 development packages installed, it will download an essentially random version of libxml2, try to build it and install it somewhere in /usr/share/perl. It will also do the same for libxml2’s dependencies like liblzma. It won’t tell you anything about that, leaving binaries of dubious provenance on your system which will never get patched with security updates. All of this while you most likely have a perfectly fine version of libxml2 already installed by your distro which will receive security fixes.

    Sounds crazy? I think so as well, but the maintainers of Perl’s Alien subsystem apparently think that this is how a sane software supply chain looks like.

    The best fix is to make sure that the libxml2 development packages are installed (libxml2-dev or libxml2-devel). This will make sure that XML::LibXML is built with your distro’s version of libxml2. As an alternative, just use your distro’s XML::LibXML package (libxml-libxml-perl on Debian and Ubuntu).

    The test failures should be fixed once this PR is merged.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search