Unable to get XML::LibXML to install Mac OS11

542 views Asked by At

I've been trying to get XML::LibXML to install on perl for a few days, and I think I've run into a wall regarding what to try next. As I understand it XML::LibXML needs to know where Libxml2 is located. I've installed Libxml2 with Homebrew, but it installs a keg-only, so my perl install doesn't know where to find it. What is the command that I need to add to my .bash_profile file so perl know where to look? I've tried using both perlbrew and Activeperl, and the results are the same.

    Parse errors: Bad plan.  You planned 31 tests but ran 0.
    Files=75, Tests=4,  5 wallclock secs ( 0.11 usr  0.08 sys +  3.85 cusr  0.75 csys =  4.79 CPU)
    Result: FAIL
    Failed 65/75 test programs. 0/4 subtests failed.
    make: *** [test_dynamic] Error 255
    SHLOMIF/XML-LibXML-2.0206.tar.gz
    /usr/bin/make test -- NOT OK
    //hint// to see the cpan-testers results for installing this module, try:
    reports SHLOMIF/XML-LibXML-2.0206.tar.gz

I tried using these three commands, but no luck

    PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"

    export PATH="/usr/local/Cellar/libxml2/2.9.10_2/bin:$PATH"

    export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

Any thoughts? Thanks in advance. Any help is much appreciated.

1

There are 1 answers

0
Håkon Hægland On BEST ANSWER

The following worked for me on macOS 10.15.5, using perlbrew with Perl version 5.30.1.

$ brew install libxml2
# Download Alien-Libxml2-0.17.tar.gz
$ tar zxvf Alien-Libxml2-0.17.tar.gz
$ cd Alien-Libxml2-0.17
# This is the location where brew installed libxml2:
$ PATH="/usr/local/opt/libxml2/bin/:$PATH" perl Makefile.PL
$ make
$ make test
$ make install
$ cpanm XML::LibXML