Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML
Asked Answered
M

4

7

I have downloaded strawberry PERL and writing one application with CGI Perl Apache on Winxp sp3). One of the libraries (written by someone else) which I using uses XML::LibXML. When i load the page it gives Internal Server Error. From Apache error log i can see this error:
Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 190.
C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll exists with all permissions. Also this library works properly on Linux. My application also works fine if I remove all code that needs LibXML.
Can anyone tell me when can be possible issue here.

Millenarianism answered 13/7, 2012 at 9:53 Comment(5)
I installed activeperl and downloaded the XML::LibXML package using PPM. It just worked!Millenarianism
This is because the DLL file required by XML::LibXML is included in the PPM, but on Strawberry perl (or on unix distros for that matter) the system's copy of the library is used. Simply install LibXML2 from the appropriate source.Selfexecuting
> Simply install LibXML2 from the appropriate source... LoL @ 'simply'Dutch
Thanks David. @Len - sometimes finding the appropriate source is not that simple. Thats why we we need forums like thisMillenarianism
That's why the 'Simply' modifier made me laugh.Dutch
D
11

If you peek into the source for DynaLoader you'll find

Many dynamic extension loading problems will appear to come from this section of code: XYZ failed at line 123 of DynaLoader.pm. Often these errors are actually occurring in the initialisation C code of the extension XS file. Perl reports the error as being in this perl code simply because this was the last perl code it executed.

You should have also gotten (but may not have noticed) the following dialog, which provides a more accurate error message:

libxml2.dll is missing

The problem isn't that perl can't find LibXML.dll; it's that LibXML.dll can't find the real libxml. (The former is just a wrapper that provides Perl bindings for the latter.) To fix that you need to ensure that Strawberry Perl's c\bin folder is in your PATH. In your case, that would be C:\strawberry\c\bin.

Daglock answered 12/12, 2014 at 16:12 Comment(2)
That's quite old but it worked for me. Don't forget to reload the cmd window after setting the PATH in the environment variables.. (it cost me 15mn to understand that was the problem)Goltz
I had the same issue when running perl through Intellij. After setting the PATH variable properly it worked fine. Thanks @michael-carman!Cirrose
A
1

You might have to check the environment variable settings in the windows, make sure that the installation path of the module is present in the PATH variable. The reason it works in linux is that make files usually set the environment variables for you in linux in windows it may not have set properly. For eg; go to Control Panel\System and Security\System click change settings then advanced tab in user variable section see if there is a variable called perl5lib. if not create an new perl5lib variable and add the path of your library ( usuall C:\Perl\site\lib but may be different in your case)

Aubrey answered 13/6, 2013 at 18:44 Comment(0)
H
0

I had the same issue after installing Strawberry perl. It was working fine when I run the script from server, but not remotely from a automation tool. The issue was because of the Environment variables not updated when we run it remotely. So I did server reboot, which resolved the issue.

Hyacinthus answered 11/2, 2019 at 11:33 Comment(0)
O
0

I encountered the same problem recently, in my case it was not related to PATH variable (it was already correct). The thing is I was executing my script from Git Bash console and as it turned out git-bash perl was being used instead of Strawberry (see git-bash perl should not be first in path). Switching to standard Windows CMD terminal helped.

Omsk answered 23/8, 2021 at 8:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.