Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

dll not embedded in PAR::Packer's output

by jowe (Sexton)
on Nov 26, 2015 at 12:22 UTC ( #1148664=perlquestion: print w/replies, xml ) Need Help??

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

Hello PerlMonks, using

  • PAR::Packer 1.028
  • Filter::Crypto 2.07
in a 'Windows 7 (32bit)', 'Strawberry 5.22.0.1' environment.

It seems like not all required DLL's are included in the resulting output (.exe).

The following example will demonstrate it:

pp -f Crypto -M Filter::Crypto::Decrypt -C -x --vvv -L ppLog_tstCrypto +.txt -o tstCrypto.exe -e "print 'Its_me';"
The pp-logfile has the following content:
C:\Strawberry\perl\site\bin/pp: Packing C:\Users\indesu\AppData\Local\ +Temp\pp1bkn6.pl C:\Strawberry\perl\site\bin/pp: Writing PAR on C:\Users\indesu\AppData +\Local\Temp\ppa6vGT.par C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Carp +.pm as lib/Carp.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Conf +ig.pm as lib/Config.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Conf +ig_git.pl as lib/Config_git.pl C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Conf +ig_heavy.pl as lib/Config_heavy.pl C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Dyna +Loader.pm as lib/DynaLoader.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Expo +rter.pm as lib/Exporter.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Expo +rter/Heavy.pm as lib/Exporter/Heavy.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/File +/Glob.pm as lib/File/Glob.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/site/lib +/Filter/Crypto/Decrypt.pm as lib/Filter/Crypto/Decrypt.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/XSLo +ader.pm as lib/XSLoader.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/auto +/File/Glob/Glob.xs.dll as lib/auto/File/Glob/Glob.xs.dll C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/site/lib +/auto/Filter/Crypto/Decrypt/Decrypt.xs.dll as lib/auto/Filter/Crypto/ +Decrypt/Decrypt.xs.dll C:\Strawberry\perl\site\bin/pp: ... adding C:/Users/indesu/AppData/Loc +al/Temp/pp1bkn6.pl as lib/pp1bkn6.pl C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/stri +ct.pm as lib/strict.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/vars +.pm as lib/vars.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/warn +ings.pm as lib/warnings.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/warn +ings/register.pm as lib/warnings/register.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as MANIFEST C:\Strawberry\perl\site\bin/pp: ... adding <string> as META.yml C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/Carp.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/Config.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Conf +ig_git.pl as lib/Config_git.pl C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/Conf +ig_heavy.pl as lib/Config_heavy.pl C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/DynaLoader. +pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/Exporter.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/Exporter/He +avy.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/File/Glob.p +m C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/Filter/Cryp +to/Decrypt.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/XSLoader.pm C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/lib/auto +/File/Glob/Glob.xs.dll as lib/auto/File/Glob/Glob.xs.dll C:\Strawberry\perl\site\bin/pp: ... adding C:/Strawberry/perl/site/lib +/auto/Filter/Crypto/Decrypt/Decrypt.xs.dll as lib/auto/Filter/Crypto/ +Decrypt/Decrypt.xs.dll C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/strict.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/vars.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/warnings.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as lib/warnings/re +gister.pm C:\Strawberry\perl\site\bin/pp: ... adding <string> as script/main.pl C:\Strawberry\perl\site\bin/pp: ... adding <string> as script/pp1bkn6. +pl C:\Strawberry\perl\site\bin/pp: ... updating MANIFEST C:\Strawberry\perl\site\bin/pp: ... updating META.yml C:\Strawberry\perl\site\bin/pp: *** C:\Users\indesu\AppData\Local\Temp +\ppa6vGT.par: 88951 bytes read, 62266 compressed, 29% saved. C:\Strawberry\perl\site\bin/pp: Generating a fresh 'parl'. C:\Strawberry\perl\site\bin/pp: Running C:\Users\indesu\AppData\Local\ +Temp\parlfS3P3Sd.exe -LppLog_tstCrypto.txt -B -OtstCrypto.exe C:\User +s\indesu\AppData\Local\Temp\ppa6vGT.par Packing "Config_git.pl"... Written as "Config_git.pl" Packing "Config.pm"... Written as "Config.pm" Packing "Compress/Raw/Zlib.pm"... Written as "Compress/Raw/Zlib.pm" Packing "Carp/Heavy.pm"... Written as "Carp/Heavy.pm" Packing "Compress/Zlib.pm"... Written as "Compress/Zlib.pm" Packing "Carp.pm"... Written as "Carp.pm" Packing "Config_heavy.pl"... Written as "Config_heavy.pl" Packing "Cwd.pm"... Written as "Cwd.pm" Packing "DynaLoader.pm"... Written as "DynaLoader.pm" Packing "Encode.pm"... Written as "Encode.pm" Packing "Encode/Alias.pm"... Written as "Encode/Alias.pm" Packing "Encode/Config.pm"... Written as "Encode/Config.pm" Packing "Encode/Encoding.pm"... Written as "Encode/Encoding.pm" Packing "Errno.pm"... Written as "Errno.pm" Packing "Exporter.pm"... Written as "Exporter.pm" Packing "Exporter/Heavy.pm"... Written as "Exporter/Heavy.pm" Packing "Fcntl.pm"... Written as "Fcntl.pm" Packing "File/Basename.pm"... Written as "File/Basename.pm" Packing "File/Copy.pm"... Written as "File/Copy.pm" Packing "File/Find.pm"... Written as "File/Find.pm" Packing "File/Glob.pm"... Written as "File/Glob.pm" Packing "File/GlobMapper.pm"... Written as "File/GlobMapper.pm" Packing "File/Path.pm"... Written as "File/Path.pm" Packing "File/Spec.pm"... Written as "File/Spec.pm" Packing "File/Spec/Unix.pm"... Written as "File/Spec/Unix.pm" Packing "File/Spec/Win32.pm"... Written as "File/Spec/Win32.pm" Packing "File/Temp.pm"... Written as "File/Temp.pm" Packing "FileHandle.pm"... Written as "FileHandle.pm" Packing "IO.pm"... Written as "IO.pm" Packing "IO/Compress/Adapter/Deflate.pm"... Written as "IO/Compress/Adapter/Deflate.pm" Packing "IO/Compress/Base.pm"... Written as "IO/Compress/Base.pm" Packing "IO/Compress/Base/Common.pm"... Written as "IO/Compress/Base/Common.pm" Packing "IO/Compress/Gzip.pm"... Written as "IO/Compress/Gzip.pm" Packing "IO/Compress/Gzip/Constants.pm"... Written as "IO/Compress/Gzip/Constants.pm" Packing "IO/Compress/RawDeflate.pm"... Written as "IO/Compress/RawDeflate.pm" Packing "IO/Compress/Zlib/Extra.pm"... Written as "IO/Compress/Zlib/Extra.pm" Packing "IO/File.pm"... Written as "IO/File.pm" Packing "IO/Handle.pm"... Written as "IO/Handle.pm" Packing "IO/Seekable.pm"... Written as "IO/Seekable.pm" Packing "IO/Uncompress/Adapter/Inflate.pm"... Written as "IO/Uncompress/Adapter/Inflate.pm" Packing "IO/Uncompress/Base.pm"... Written as "IO/Uncompress/Base.pm" Packing "IO/Uncompress/Gunzip.pm"... Written as "IO/Uncompress/Gunzip.pm" Packing "IO/Uncompress/RawInflate.pm"... Written as "IO/Uncompress/RawInflate.pm" Packing "List/Util.pm"... Written as "List/Util.pm" Packing "PerlIO.pm"... Written as "PerlIO.pm" Packing "PerlIO/scalar.pm"... Written as "PerlIO/scalar.pm" Packing "Scalar/Util.pm"... Written as "Scalar/Util.pm" Packing "SelectSaver.pm"... Written as "SelectSaver.pm" Packing "Symbol.pm"... Written as "Symbol.pm" Packing "Tie/Hash/NamedCapture.pm"... Written as "Tie/Hash/NamedCapture.pm" Packing "Time/Local.pm"... Written as "Time/Local.pm" Packing "Win32.pm"... Written as "Win32.pm" Packing "XSLoader.pm"... Written as "XSLoader.pm" Packing "attributes.pm"... Written as "attributes.pm" Packing "base.pm"... Written as "base.pm" Packing "bytes.pm"... Written as "bytes.pm" Packing "constant.pm"... Written as "constant.pm" Packing "integer.pm"... Written as "integer.pm" Packing "lib.pm"... Written as "lib.pm" Packing "overload.pm"... Written as "overload.pm" Packing "overloading.pm"... Written as "overloading.pm" Packing "parent.pm"... Written as "parent.pm" Packing "strict.pm"... Written as "strict.pm" Packing "utf8.pm"... Written as "utf8.pm" Packing "vars.pm"... Written as "vars.pm" Packing "warnings.pm"... Written as "warnings.pm" Packing "warnings/register.pm"... Written as "warnings/register.pm" Packing "PAR.pm"... Written as "PAR.pm" Packing "PAR/Filter.pm"... Written as "PAR/Filter.pm" Packing "PAR/Filter/PatchContent.pm"... Written as "PAR/Filter/PatchContent.pm" Packing "PAR/Filter/PodStrip.pm"... Written as "PAR/Filter/PodStrip.pm" Packing "PAR/Heavy.pm"... Written as "PAR/Heavy.pm" Packing "PAR/SetupProgname.pm"... Written as "PAR/SetupProgname.pm" Packing "PAR/SetupTemp.pm"... Written as "PAR/SetupTemp.pm" Packing "Archive/Zip.pm"... Written as "Archive/Zip.pm" Packing "Archive/Zip/Archive.pm"... Written as "Archive/Zip/Archive.pm" Packing "Archive/Zip/DirectoryMember.pm"... Written as "Archive/Zip/DirectoryMember.pm" Packing "Archive/Zip/FileMember.pm"... Written as "Archive/Zip/FileMember.pm" Packing "Archive/Zip/Member.pm"... Written as "Archive/Zip/Member.pm" Packing "Archive/Zip/NewFileMember.pm"... Written as "Archive/Zip/NewFileMember.pm" Packing "Archive/Zip/StringMember.pm"... Written as "Archive/Zip/StringMember.pm" Packing "Archive/Zip/ZipFileMember.pm"... Written as "Archive/Zip/ZipFileMember.pm" Packing "PAR/Dist.pm"... Written as "PAR/Dist.pm" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/42f0da6c.dll"... Written as "auto/attributes/attributes.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/6381b17c.dll"... Written as "auto/Fcntl/Fcntl.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/65a2e229.dll"... Written as "auto/List/Util/Util.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/7013e796.dll"... Written as "auto/IO/IO.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/71e37bc8.dll"... Written as "auto/Compress/Raw/Zlib/Zlib.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/85aec634.dll"... Written as "auto/File/Glob/Glob.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/ae1b6876.dll"... Written as "auto/Tie/Hash/NamedCapture/NamedCapture.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/af0170c5.dll"... Written as "auto/Encode/Encode.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/d276a8be.dll"... Written as "auto/Cwd/Cwd.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/e2898345.dll"... Written as "auto/Win32/Win32.xs.dll" Packing "C:\Users\indesu\AppData\Local\Temp\par-696e64657375\cache-681 +a18272ef4aadac39226f3a69834785c8a12e6/f3af5040.dll"... Written as "auto/PerlIO/scalar/scalar.xs.dll"
When executing this example in a Windows 7 (32bit) non-Perl environment I receive the following error message:
C:\>tstCrypto.exe Can't load 'C:\Users\Jo\AppData\Local\Temp\par-4a6f\temp-2432\nmtRPcuQ +p9.xs.dll' for module Filter::Crypto::Decrypt: load_file:Das angegebene Modul wu +rde nicht gefunden at C:/Strawberry/perl/lib/DynaLoader.pm line 193. at C:/Strawberry/perl/site/lib/PAR/Heavy.pm line 120. BEGIN failed--compilation aborted at Filter/Crypto/Decrypt.pm line 37. Compilation failed in require at script/pp1bkn6.pl line 1. BEGIN failed--compilation aborted at script/pp1bkn6.pl line 1. C:\> ---------------------------------------------------- Remark: Das angegebene Modul wurde nicht gefunden = Requested module n +ot found ----------------------------------------------------
Is there anything I am doing wrong? Your help is very much appreciated.

Thanks very much in advance - Jo

Replies are listed 'Best First'.
Re: dll not embedded in PAR::Packer's output
by Discipulus (Abbot) on Nov 26, 2015 at 18:38 UTC
    I read in the docs for pp i read that -l is indicated for missing dll. Maybe the module you want to include is not pure Perl and needs some dll to run.
    --link nmtRPcuQp9.xs.dll #or --link c:\full\path\to\nmtRPcuQp9.xs.dll
    Also Re: Delay running Perl execs in Windows is interesting.

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        Another Anonymous Monks's Authoritative Answer!!

        L*
        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      The DLL's do exist (in my case) in C:\Strawberry\c\bin and the directory is part of the 'Path'-environment variable.

      Even if I include the missing DLL manually using the '-l'-option then other DLL's are missing.

      Btw: I used this Perl-one-liner just as an example to demonstrate the problem. In reality there is a 20,000-lines-of-code application with a lot of required DLL's.

Re: dll not embedded in PAR::Packer's output
by syphilis (Bishop) on Nov 26, 2015 at 22:39 UTC
    Can't load 'C:\Users\Jo\AppData\Local\Temp\par-4a6f\temp-2432\nmtRPcuQp9.xs.dll'

    I would run:

    objdump -x C:\Users\Jo\AppData\Local\Temp\par-4a6f\temp-2432\nmtRPcuQp9.xs.dll | grep "DLL Name"

    That will list the names of all of the dlls that particular dll wants to load.
    Obviously it relies on the presence of "objdump.exe" (which ships with Strawberry) and "grep.exe" (which does *not* ship with Strawberry, but is available from here).

    Cheers,
    Rob
      Thank you guys for your help. Question: Are your suggestions workarounds or is this the way pp is supposed to work?

      Thanks again - Jo

        Are your suggestions workarounds or is this the way pp is supposed to work?

        Ideally, pp would pack all of the needed dlls except, I guess, for the Windows system dlls.
        Unfortunately, it can sometimes miss one or more dlls that need to be packed in.

        When that happens you need to firstly identify, and then explicitly include, those dlls.
        I think it's safe to leave out missing Windows system dlls, as the ones on the destination machine should load ok.

        If the "destination" machine is the machine that built the executable, then the executable should run ok (without any need to pack in the missing dlls) if the path includes the location of those "missing" dlls.

        Cheers,
        Rob
Re: dll not embedded in PAR::Packer's output
by RonW (Parson) on Dec 01, 2015 at 18:51 UTC

    Since you are packaging a large-ish application, it would probably be better to create an installer that makes a self-contained folder tree with your application, Perl and the libraries you depend on.

    (Executables created by pp (or perl2exe or similar) have a long startup time because everything bundled in to the exe file has to be extracted to a temporary folder, first. Also, creating an installer will give you more control.)

    In the past, I have used the "portable edition" of Strawberry Perl as a base for creating installers for custom Perl installations under Windows. Including your application as part of such a custom Perl installer would not be much more work.

    Disclaimer: Last time I did this was well over a year ago, so I've forgotten some details. I found the information I needed by searching the web and reading various scripts in the portable Perl installation.

    What I remember about what I did:

    1. "Installed" the "portable edition" of Strawberry Perl on a Windows PC that had no other Perl installed.
    2. Launched the .bat file in PESP to start a command console to run Perl commands.
    3. Used cpan to install needed modules.
    4. Copied known required DLLs to the bin folder.
    5. You can copy your Perl programs to the bin folder. Then test that it works. Add any missing DLLs and test again.
    6. Made a copy of the above mentioned .bat file to SetUp.bat
    7. Modified this new SetUp.bat to perform needed set up actions, including running a Perl program that adds entries to the Windows registry.
    8. Created a README.txt file saying to run the SetUp.bat file.
    9. Created a zip file of the customized Perl installation.
    10. Copied the zip file to another PC with no Perl, extracted it, ran SetUp.bat and tested several Perl programs to make sure they ran correctly. And test your program. If any DLLs are missing, go back, add them to the bin folder, create a new zip file and test it.
    11. Distributed the zip file with the instructions to extract to c:\CompanyPerl and read the README.txt file.

    If this is too hard for your users, try rewriting SetUp.bat as SetUp.pl, then use pp -a CompanyPerl.zip SetUp.pl to create a SetUp.exe - then test it on another PC

    If your users demand a "proper" Windows installer, you can use, for example, 7-zip or NSIS, to create a Windows installer.

    Once the initial install is done, more Perl programs can be "installed" by copying them to the bin folder in the custom Perl installation.

        Had not heard of Inno Setup before. Thanks.

        I had used NSIS once, years ago, but was a lot of work. Then I discovered that 7-zip files can be converted into installers. Basically, it's a variant of a self-extracting archive that auto-runs a cmd file (like a bat file) after the extraction. Was not a lot of work. I had the cmd file set some environment variables, copy files, then start a Perl program to finish the installation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1148664]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2021-07-27 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?