in reply to Cannot build/install XML::Parser

How did you manage to install XML::Parser::Expat without XML::Parser? The former is in the dist of the latter.

Suggestion: Install from the RHEL repo using dnf instead?

Available Packages perl-XML-Parser.x86_64 2.44-11.el8 + rhel-8-for-x86_64-appstream-rpms

🦛

Replies are listed 'Best First'.
Re^2: Cannot build/install XML::Parser
by nixcat (Initiate) on Mar 13, 2023 at 17:51 UTC

    Hi there - thanks for the reply. Because I don't have root access on this server all the Perl modules have been installed in a subdir of a user that owns all the files for the application (like a service account). These are the settings in the .bashrc for that user in question that were configured when I ran cpan with a -o to configure:

    PATH="/home/user/perl5/bin${PATH:+:${PATH}}"; export PATH; PERL5LIB="/home/user/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export + PERL5LIB; PERL_LOCAL_LIB_ROOT="/home/user/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LO +CAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; PERL_MB_OPT="--install_base \"/home/user/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=/home/user/perl5"; export PERL_MM_OPT;

    All modules were installed from scratch using cpanm. And to your point about XML::Parser::XPAT - that's what I'm puzzled about. It installed just fine. So I don't understand why the Parser would fail.

      Looking at their respective Makefile.PL, X::P calls check_lib of Devel::CheckLib to find/verify the expat lib. But X::P::E just assumes that the library is there and links with -lexpat. And if it is there, as you said, then no problem. So the failure is most likely with check_lib of Devel::CheckLib. You could write a minimal script using said sub to see if it fails and how:

      use Devel::CheckLib; $expat_libpath = $ENV{EXPATLIBPATH} || ''; $expat_incpath = $ENV{EXPATINCPATH} || ''; my @replacement_args; foreach (@ARGV) { if (/^EXPAT(LIB|INC)PATH=(.+)/) { if ( $1 eq 'LIB' ) { $expat_libpath = $2; } else { $expat_incpath = $2; } #push(@replacement_args, "$1=$2"); } else { push( @replacement_args, $_ ); } } @ARGV = @replacement_args; # ** I am using check_lib_or_exit() for verbosity check_lib_or_exit( # fill in what you prompted the user for here lib => [qw(expat)], header => ['expat.h'], incpath => $expat_incpath, ( $expat_libpath ? ( libpath => $expat_libpath ) : () ), );

      You could also hack Devel::CheckLib (since you own it) to make it more verbose and pinpoint exactly where the problem is.

      The absolute shortcut is to hack X::P's Makefile.PL to not exit 0 when it thinks that expat libraries/headers can not be found (according to CheckLib), and see if it will be linked eventually (since it is located in /usr/lib it will need no extra CFLAGS/LDFLAGS).

      But you must make sure that the library is there and its header files too.

      bw, bliako

        You could also hack Devel::CheckLib (since you own it) to make it more verbose and pinpoint exactly where the problem is.

        lol or just ditch the checklib, old problems are best abandoned