PAR::Packer issue finding GD module in Win64 environment

Charles Myers <[email protected]> Mon, 16 Apr 2018 23:07:40 +0000
Newsgroups gmane.comp.lang.perl.par
Message-ID <MWHPR01MB249681AA19E02D1F303243CBEFB00@MWHPR01MB2496.prod.exchangelabs.com>
Per your Par::Tutorial, sending you a simple example so you can fix this - or tell me I am missing something.

Simple script, "use_GD.pl" creates a blank PNG image using GD module.

Windows 10, 64-bit.
Strawberry Perl (5.20.1.1-64bit).
PAR Packager, version 1.043 (PAR version 1.015)
GD loaded in environment via cpan.

pp -M GD -o use_GD.exe use_GD.pl


  1.  Executable functions on packaging machine.


  1.  Transfer use_GD.exe to clean Win64 environment (no perl, no libs).  Executable is unable to find GD or perhaps a requirement of GD with following error:


Can't load 'C:\Users\username\AppData\Local\Temp\par-xxxx\cache-xxxx\be064bef.xs.dll' for module GD: load_file: The specified module could not be found at C:/Strawberry/perl/lib/DynaLoader.pl line 193.
  at C:/Strawberry/perl/site/lib/PAR/Heavy.pm line 123.
Compilation failed in require at scripot/useGD.pl line 4.
BEGIN failed-compilation aborted at script/use_GD.pl line 4.

Per PAR::Tutorial documentation, I expected all required modules to be included and unpacked in the temp location.  It appears that the PAR unpacking is looking for a Strawberry/perl install lib location instead of the packaged libs.  If I install Strawberry Perl on the new system, then the executable runs.

Reviewing the package, GD.pm is present under libs/GD.pm.  If I go to the temp file location generated by the executable, libs/GD.pm is there as well.  It really seems suspicious that there is a reference to C:/Strawberry/* for a portable executable.

Regards,
Charles Myers
use_GD.pl (application/octet-stream, 393 B)
#!C:\Strawberry\perl\bin\perl -w

#use lib './lib';
use GD;

## Create blank image
GD::Image->trueColor(1);
$image = new GD::Image(100,100);

$pngfile = 'temp.png';

open(PNG, '>:raw', "$pngfile") or &died(" -ERROR- Cannot open $pngfile for write: $!\n");
print PNG $image->png;
close(PNG);

print "Script complete.\n";
`pause`;

sub died {
	print @_;
	`pause`;
	die;
}