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

Hi, I've just installed Strawberry Perl on a new Windows laptop, but I'm having problems running XML::LibXML. I've installed it using the Strawberry cpan client, it installs fine, but when I come to use it in a script, I get the message:

Can't load 'C:/Strawberry/perl/vendor/lib/auto/XML/LibXML/LibXML.xs.dll' for module XML::LibXML: load_file:The specified path is invalid at C:/Strawberry/perl/lib/DynaLoader.pm line 193. at C:/Strawberry/perl/vendor/lib/XML/LibXML.pm line 156.

BEGIN failed--compilation aborted at C:/Strawberry/perl/vendor/lib/XML/LibXML.pm line 156.

I've checked my Path and environment variables and all seem fine. The dll file in the message exists and is in the location reported. Can anyone help?

Replies are listed 'Best First'.
Re: Dynaloader not loading LibXML
by stevieb (Canon) on Apr 25, 2016 at 14:03 UTC

    Welcome to the Monastery, domglennon!

    Does the first answer here on SO help?

    It states that something may still be missing from your PATH. Could you post your path (echo %PATH%), and check to see where any "libxml*" files may reside in your c:/strawberry directory structure?

      hi Stevieb, thank you for the kind welcome! I should have said I'd seen that issue on SO and done everything recommended there. Here's my path (relevant folders only):

      C:\strawberry\perl\bin\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;

      And I've added the system variable perl5lib, which has the value:

      C:/Strawberry/perl/vendor/lib;C:/Strawberry/perl/vendor/lib/auto;C:/Strawberry/perl/site/lib;C:/Strawberry/perl/lib; I also created an issue of my own at SO: http://stackoverflow.com/questions/36793878/cant-run-xmllibxml-on-strawberry-perl-invalid-path-in-dynaloader-pm# - as the advice given in the other issue didn't fix it.
        And I've added the system variable perl5lib

        Why ? (I think this might be your problem).
        Try removing it - I can't see how it can possibly be doing anything useful.

        Cheers,
        Rob

        And here's a listing of all files/folders containing LibXML under the Strawberry folder:

        Name Size Type + Modified Attr Location LibXML File Folder + Friday 17:36 ----- C:\Straw...\vendor\lib\auto\XML libxml File Folder + Friday 17:35 ----- C:\Strawberry\c\include LibXML File Folder + Friday 17:35 ----- C:\Strawberry\...\vendor\lib\XML libxml2 File Folder + Friday 17:36 ----- C:\Strawberry\licenses .packlist 2.22 KB File + Friday 17:36 -a--- C:\Strawberry\...\auto\XML\L... .packlist 2.22 KB File + Friday 17:36 -a--- C:\Strawberry\...\auto\XML\L... .packlist 2.22 KB File + Friday 17:36 -a--- C:\Strawberry\...\auto\XML\L... _INFO_ 109 bytes File + 26/01/2015 18:04 -a--- C:\Strawberry\licenses\libxml2 AUTHORS 208 bytes File + 30/07/2009 17:24 -a--- C:\Strawberry\licenses\libxml2 COPYING 1.25 KB File + 03/10/2014 11:00 -a--- C:\Strawberry\licenses\libxml2 LibXML.pm 64.4 KB PM File + 27/02/2016 12:17 -a--- C:\Strawberry\...\vendor\lib\XML LibXML.pod 14.7 KB POD File + 27/02/2016 12:18 -a--- C:\Strawberry\...\vendor\lib\XML libxml-2.0.pc 305 bytes PC File + 26/01/2015 18:03 -a--- C:\Strawberry\c\lib\pkgconfig LibXML.xs.dll 342 KB Application extension + 06/03/2016 23:30 -a--- C:\Strawberry\...\auto\XML\L... LibXML.xs.dll 342 KB Application extension + 06/03/2016 23:30 -a--- C:\Strawberry\...\auto\XML\L... LibXML.xs.dll 342 KB Application extension + 06/03/2016 23:30 -a--- C:\Strawberry\...\auto\XML\L... LibXML.xs.dll 342 KB Application extension + 06/03/2016 23:30 -a--- C:\Strawberry\...\auto\XML\L... libxml2.a 1.02 MB A File + 26/01/2015 18:03 -a--- C:\Strawberry\c\lib libxml2-2__.dll 1.20 MB Application extension + 26/01/2015 18:03 -a--- C:\Strawberry\c\bin
Re: Dynaloader not loading LibXML
by syphilis (Archbishop) on Apr 26, 2016 at 10:55 UTC
    I've installed it using the Strawberry cpan client, it installs fine ...

    Do you mean that all of the tests passed ? (Surely not.)
    One would expect that all tests would have failed with the exact same error as you've reported, and that you would have had to use force to effect the installation of XML::LibXML.
    Otherwise you've invented some (hitherto unknown) way of breaking a perl installation.

    I take it that the error can be produced by running simply:
    perl -MXML::LibXML -e 1
    Cheers,
    Rob
      OK, here's an odd thing: it does run from the C drive, but I get the error message when I try to run it from a network drive. Same for any scripts using LibXML. Any ideas why this should be?
        it does run from the C drive, but I get the error message when I try to run it from a network drive

        I've no experience with running from a network drive - which is probably the reason that I've never seen that "specified path is invalid .." error message before.
        Could it be that 'C:/Strawberry/perl/vendor/lib/auto/XML/LibXML/LibXML.xs.dll' is an invalid path specification (as the error message states) when running from a network drive ?
        Hopefully someone with better knowledge of running from a network drive can provide something a bit more definite.

        (An incorrect UPDATE removed.)

        One other (probably unrelated) thing to note is that your error message relates to the XML::LibXML that's installed in perl/vendor/lib.
        That's the XML::LibXML that shipped with Strawberry Perl - it's not the XML::LibXML that you installed. (The one you installed should be in perl/site/lib.)
        Normally, perl/site/lib comes before perl/vendor/lib in @INC, which means that in a normal situation the XML::LibXML in perl/site/lib is the one that would get loaded.
        But your perl5lib changed the @INC order, putting perl/vendor/lib ahead of perl/site/lib and thus ensuring that the XML::LibXML in perl/vendor/lib is the one that gets loaded.

        Cheers,
        Rob
Re: Dynaloader not loading LibXML
by Anonymous Monk on Apr 25, 2016 at 21:57 UTC
      Thanks - the command line doesn't give any output (am I supposed to replace the ... with something? Apologies if I'm being stupid) , but I've run the GUI and pointed it to Perl. It's showing a number of DLLs that it can't find, mainly API-MS-WIN-.* , but also DCOMP.DLL, GPSVC.DLL and IESHIMS.DLL - is this a concern?

        Thanks - the command line doesn't give any output (am I supposed to replace the ... with something? Apologies if I'm being stupid)

        The output is in the .txt file, you're supposed to replace the ...perl.exe... parts with the program you run,

        if you run perl.exe foo.pl

        then the command you run is   depends.exe /c /f:1 /pb /ot:temp.txt  perl.exe foo.pl

        when in doubt use absolute/full paths (C:\perl\bin\perl.exe or whatever)

        depends.exe will tell you what .exe/.dll is loading what .exe/.dll and which one is failing and why

        if its not clear why/what then post the contents of temp.txt here inside code tags