rschupp / PAR-Packer

(perl) Generate stand-alone executables, perl scripts and PAR files https://metacpan.org/pod/PAR::Packer
Other
48 stars 13 forks source link

Windows 10: Error: 501 Can't load c8c63bf2.xs.dll for module Net::SSLeay: load_file:The specified module could not be found (LWP::Protocol::https not installed) #21

Closed hakonhagland closed 4 years ago

hakonhagland commented 4 years ago

I am trying to create an .exe from the following Perl script:

use strict;
use warnings;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
my $res = $ua->get( 'https://metacpan.org/pod/pp');
if ($res->is_success) {
  print "ok\n";
}
else {
  die $res->status_line;
}

On Windows 10, with Strawberry Perl, perl version 5.30.1, running pp from command prompt:

pp -o p4.exe -x p.pl

produces an executable p4.exe that runs fine on the current machine and produces output ok. When I upload the p4.exe to another windows 10 machine that does not have perl installed and run it I get output:

501 Can't load 'C:\Users\hakon\AppData\Local\Temp\par-68616b6f6e\cache-2fc254075e68b8cca263637e29f9a640f6669c6a\c8c63bf2.xs.dll' for module Net::SSLeay: load_file:The specified module could not be found (LWP::Protocol::https not installed) at script/p.pl line 12.

If I run pp with verbose option, I can see that it packages LWP::Protocol::https:

pp -o p4.exe -x -vv p.pl | findstr Protocol/http
C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/LWP/Protocol/http.pm
C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/LWP/Protocol/https.pm

Any ideas what is going on?

See also this issue on stackoverflow.com

rschupp commented 4 years ago

Your exe misses the libssl* DLL (and other DLLs it depends on) which .../SSLeay.dll is linked against.

PAR::Packer does not pack these non-Perl DLL dependencies. You can either chase them done and explicitly pack them by hand with pp --link ..., see for instance this thread in the par@perl.org mailing list. Or use Shawn Laffan's App::PP::Autolink that does this for you.

hakonhagland commented 4 years ago

Thank you! Using App::PP::Autolink worked fine. I was missing: libssl-1_1-x64__.dll, zlib1__.dll, and libcrypto-1_1-x64__.dll