Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to use XML::Parser to run in a Perl 5.005 MP RAS Unix environment. I was able to make and make install the required expat parser with no errors.

I also installed XML::Parser 2.30 with no errors.

perl returns the following error when I try and use XML::Parser.
...Can't load Expat.so for module XML::Parser::Expat: dynamic linker : perl: error opening libexpat.so.0 at DynaLoader.pm line 168

...at Parser.pm line 15 Begin failed - compilation aborted...
Could any enlightened monk help me understand what this error message means? I know very little about linking to C libraries which is apparently what the XML::Parser module does.

Replies are listed 'Best First'.
XML needs Expat
by Petruchio (Vicar) on Dec 07, 2000 at 13:20 UTC
    Can't load Expat.so for module XML::Parser::Expat: dynamic linker : perl: error opening libexpat.so.0 at DynaLoader.pm line 168

    ...at Parser.pm line 15 Begin failed - compilation aborted...

    Could any enlightened monk help me understand what this error message means?


    Yes.

    Now I suppose you'll actually want to know what it means. :-) It means you need to install Expat. You can find it here... then since you're in Unix, unzip it, untar it, and follow the very simple instructons in README. I would imagine one would do something similar under Windows.

    Actually, you should try installing your modules with CPAN.pm. You do such things by issuing the command:

    perl -MCPAN -e shell

    On my system (Debian), there's a script called cpan to simplify things. Type perldoc CPAN for details.

    CPAN checks for such dependencies, and would not (willingly) have installed XML for you without it. Instead, it would have given you some helpful instructions on installing Expat.

Re: XML Module Loading Problem
by mirod (Canon) on Dec 07, 2000 at 14:28 UTC

    Actually installing XML::Parser normally installs Expat, at least with previous versions of XML::Parser, so you should not have to install Expat separately.

    There are various versions of Expat out there, one that comes with Apache (for Xerces I think) and I think others (a Python one?). All are dynamically linked so you might have installed one that's not compatible with the version of XML::Parser you have.

    That said I have no idea how to fix this! try installing XML::Parser 2.27 maybe? I think it uses yet-another-version of Expat.

    Clark Cooper (for Perl), Sean McGrath (for Python) and others are currently trying to merge back all of the different versions (which still does not help you much I guess).

      Actually inatalling XML::Parser normally installs Expat, at least with previous versions of XML::Parser, so you should not have to install Expat separately.

      That's interesting. I've installed XML::Parser on two boxen via CPAN in just the last two weeks, and it doesn't install Expat. Though I only really run Debian... so not to say you're wrong, but my experiences have been consistent and different than yours. Perhaps someone will present a larger view and clue us in.

      Update:

      From the README for XML-Parser-2.30:

      Differences from Version 2.29 ============================= Expat is no longer included with this package. It must now be already installed on your system as a library. You may download the library version of expat from http://sourceforge.net/projects/expat/. After downloading, expat must be configured (an automatic script does this), built and installed.

      mirod runs 2.27... guess that explains it.

        Thanks, mirod and Petruchio. I gave up on trying to install XML::Parser 2.30, and installed 2.29 instead. It works fine.

        I hope that the developers of XML::Parser will return to the pre-2.30 practice of offering a version which has expat built in. Some people want to use XML and perl but are not experts in module and C library installation.

        Including expat for those who want it seems like the perlish thing to do.