Skip Menu |
 

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 106825
Status: open
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: ArntW [...] enfocus.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: failure to load mysql.xs.dll because it cannot find libmysql_.dll
Date: Wed, 2 Sep 2015 15:09:10 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Witteveen, Arnt" <ArntW [...] enfocus.com>
Download (untitled) / with headers
text/plain 4.7k
Hi, I'm running into a problem described in a few places online, e.g. here: http://stackoverflow.com/questions/4206439/sequenced-steps-to-install-perl-strawberry-mysql-and-dbdmysql-on-windows-xp The only solution found online seems to be to copy a dll from one folder of perl into another one. A similar problem seems to be described here https://rt.cpan.org/Public/Bug/Display.html?id=99104 (and in reports linked form that). I've looked into this a bit more on my system, because copying files from one part of a distribution to another does not seem like a good solution. In particular, many comments suggest the problem is in the PATH variable, and as far as I can see, it isn't for me. First, the error message, when I access any of the pages of Bugzilla (which I'm trying to set up): -------- install_driver(mysql) failed: Can't load 'C:/StrawberryPerl/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/StrawberryPerl/perl/lib/DynaLoader.pm line 193. at (eval 44) line 3. Compilation failed in require at (eval 44) line 3. Perhaps a required shared library or dll isn't installed where expected at Bugzilla/DB.pm line 1284. For help, please send mail to this site's webmaster, giving this error message and the time and date of the error. [Wed Sep 2 16:01:24 2015] index.cgi: install_driver(mysql) failed: Can't load 'C:/StrawberryPerl/perl/vendor/lib/auto/DBD/mysql/mysql.xs.dll' for module DBD::mysql: load_file:The specified module could not be found at C:/StrawberryPerl/perl/lib/DynaLoader.pm line 193. [Wed Sep 2 16:01:24 2015] index.cgi: at (eval 44) line 3. [Wed Sep 2 16:01:24 2015] index.cgi: Compilation failed in require at (eval 44) line 3. [Wed Sep 2 16:01:24 2015] index.cgi: Perhaps a required shared library or dll isn't installed where expected [Wed Sep 2 16:01:24 2015] index.cgi: at Bugzilla/DB.pm line 1284. -------- As you can see, I've installed Strawberry perl 'C:/StrawberryPerl'. Version is 5.22.0.1 64bit. The OS is a Windows Server 2008 R2 Standard. I have installed the necessary perl modules through bugzilla's script to do so ("C:\StrawberryPerl\perl\bin\perl.exe install-module.pl --all"), which made it get a bunch of modules from cpan. Tracing this issue with Microsoft Sysinternals Process Monitor, I can see that mysql.xs.dll fails to load because its dependency libmysql_.dll is not found. This file is part of the distribution, found at: C:\StrawberryPerl\c\bin\libmysql_.dll . Process Monitor shows these locations are searched for libmysql_.dll : C:\StrawberryPerl\perl\vendor\lib\auto\DBD\mysql\libmysql_.dll C:\Windows\SysWOW64\libmysql_.dll C:\Windows\system\libmysql_.dll C:\Windows\libmysql_.dll C:\inetpub\Bugzilla\libmysql_.dll Looking at https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx#search_order_for_desktop_applications I can see this matches " Standard Search Order for Desktop Applications" with SafeDllSearchMode enabled, but without searching PATH. To make sure perl is seeing the path I think it sees, I made a perl script in the Bugzilla folder, and accessed it via a browser just like I access the rest of Bugzilla, and let it print the path and INC: print "path : $ENV{PATH}\n"; print "INC: @INC \n" ; the result is: path : C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\System Center Operations Manager 2007\;C:\Program Files\Perforce;C:\Program Files (x86)\PDFtk\bin\;C:\StrawberryPerl\c\bin;C:\StrawberryPerl\perl\site\bin;C:\StrawberryPerl\perl\bin; INC: C:/StrawberryPerl/perl/site/lib C:/StrawberryPerl/perl/vendor/lib C:/StrawberryPerl/perl/lib I've then updated the Handler Mapping in IIS 7 to add -IC:/StrawberryPerl/c/bin to the perl command line. This is reflected in 'INC' as expected: path : path : C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\System Center Operations Manager 2007\;C:\Program Files\Perforce;C:\Program Files (x86)\PDFtk\bin\;C:\StrawberryPerl\c\bin;C:\StrawberryPerl\perl\site\bin;C:\StrawberryPerl\perl\bin; INC: C:/StrawberryPerl/c/bin C:/StrawberryPerl/perl/site/lib C:/StrawberryPerl/perl/vendor/lib C:/StrawberryPerl/perl/lib However this does not change the error, nor does it change the locations that are searched for libmysql_.dll seen in Process Monitor. So, in summary: as far as I can determine, the folders in the path are not used to load the dependent dll's . I've also tried to run, command line: perl -IC:/StrawberryPerl/c/bin -xC:\inetpub\Bugzilla -wT "index.cgi" index.cgi this returns the same error message, so it's not caused by IIS or it's cgi implementation. This then causes issues when one dll installed by Strawberry Perl needs another one.
Subject: [rt.cpan.org #106825] additional information
Date: Thu, 3 Sep 2015 08:14:27 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Witteveen, Arnt" <ArntW [...] enfocus.com>
Download (untitled) / with headers
text/plain 596b
Looking further for reasons why the path isn't used to search for dll's, it turns out that MS KB 2533623 (https://support.microsoft.com/en-us/kb/2533623 ) is installed. This changes the dll search path as documented on https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586.aspx#search_order_using_load_library_search_flags_ and https://msdn.microsoft.com/en-us/library/windows/desktop/hh310515.aspx . Specifically, those pages show that the PATH will not be used at all to search for a dll. However, AddDllDirectory and SetDllDirectory can be used to influence the search path.
Subject: Re: [rt.cpan.org #106825] failure to load mysql.xs.dll because it cannot find libmysql_.dll
Date: Thu, 3 Sep 2015 13:06:41 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
Download (untitled) / with headers
text/plain 600b
Thanks for your analysis. The problem with moving or copying (duplicating) libmysql_.dll to C:/StrawberryPerl/perl/vendor/lib/auto/DBD/mysql/ is that is fixes only DBD::mysql but what about DBD::Pg? or DBD::Oracle? or what if the perl app will use quite common Net::SSLeay? or some XML or graphics modules using external *._dll? IMO we cannot duplicate all possible dlls packed with strawberry perl in this way. I'll try to think about that a bit more. What definitely would be great is having something like HOWTO.strawberry-perl+MS-IIS.txt (describing all necessary workarounds) -- kmx
Subject: Re: [rt.cpan.org #106825] additional information
Date: Thu, 3 Sep 2015 13:17:57 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
Download (untitled) / with headers
text/plain 106b
I mean something like this: http://php.net/manual/en/install.windows.iis7.php Just for strawberry perl.
Subject: [rt.cpan.org #106825]
Date: Thu, 3 Sep 2015 11:50:19 +0000
To: "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: "Witteveen, Arnt" <ArntW [...] enfocus.com>
Download (untitled) / with headers
text/plain 696b
I agree that duplicating these files isn't a good solution (although I guess you could copy all the dependencies needed by each one to their folders, but that would probably be a lot of duplicate files). Depending on the reasons for having mysql.xs.dll in a path like perl/vendor/lib/auto/DBD/mysql, a solution might be to do it the other way around: move mysql.xs.dll and all similar dll's into 1 folder together with their dependencies? One other way would be to patch the loading of the module in perl to add the right dll search paths with something like AddDllDirectory, but I've never looked at perl source so I haven't really been able to find where the module loading happens.
Subject: Re: [rt.cpan.org #106825]
Date: Thu, 3 Sep 2015 13:58:54 +0200
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] cpan.org>
Download (untitled) / with headers
text/plain 181b
Another trouble is that when you install an upgrade of DBD::mysql yourself it will be installed in: perl/_*site*_/lib/auto/DBD/mysql/mysql.xs.dll and the problem is back again.
Subject: My quick suggestion
Download (untitled) / with headers
text/plain 690b
My quick suggestion is that we release-note this problem with this example code (I seem to recall that we install Win32::API along with Strawberry) based on what I see at https://support.microsoft.com/en-us/kb/2533623 and the links under 'More Information' there. # Given an unchanged @INC, $INC[-2] is $Strawberry/perl/lib. my $SetDDFlags = Win32::API::More->new( 'kernel32', 'SetDefaultDirectoryFlags', 'i', 'i' ); if ($SetDDFlags) { $SetDDFlags(0x00001000); } my $AddDLLDirectory = Win32::API::More->new( 'kernel32', 'AddDLLDirectory', 'P', 'v' ); if (AddDLLDirectory) { $AddDLLDirectory($INC[-2] . "/../../c/lib\0"); }
Or, at least, something to that effect, this code is first-draft.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.