http://www.perlmonks.org?node_id=11131087

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

Good day Monks,

I hope you are all well. I am very novice Perl user, in fact I have only used sendEmail.exe by Brandon Zehm, which is a packed Windows executable based on Perl.

http://caspian.dotconf.net/menu/Software/SendEmail/

That specific version of sendEmail is old and only supports TLSv1.0

I have found an updated Perl script patched to used TLSv1.2.

https://gist.github.com/wilkart/7eb6c8ec7eb6b0cb18a8439bc40da6f8

I have used Par::Packer (installed via cpan)to pack this updated Perl script into an executable, but no matter what I do, the executable keeps asking for Net::SSLeay and IO::Socket::SSL if Perl is not installed. (It works fine if Perl is installed or if I run the .pl script)

Below is the error message from sendEmail.

sendEmail.exe: ERROR => No TLS support! SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)

Things that I tried:

  • I have used pp with -M Net::SSLeay -M IO::Socket::SSL.
  • I have installed Strawberry Perl 32 bit and 64 bit. (v5.32.1.1)
  • I have used Perl Portable instead. (v5.32.1.1)
  • I have used an older version of Perl. (v5.26.3.1 32 bit Portable)
  • I have made sure the needed packages are installed and up to date.
  • I have tried to use Dependency Walker, but it seems to hang on my workstation (Windows 10 20H2 x64).
  • pp -x sendEmail.pl fails with this error message: SYSTEM ERROR in executing sendEmail.pl : 256 at C:/Perl/perl/site/lib/Module/ScanDeps.pm line 1503.
  • I do not understand why the generated executable is not finding or loading the required libraries.

    Any help is greatly appreciated.

    • Comment on pp generated executable can't find or load libraries

    Replies are listed 'Best First'.
    Re: pp generated executable can't find or load libraries
    by swl (Priest) on Apr 13, 2021 at 09:36 UTC

      It appears that the use of Net::SSLeay and IO::Socket::SSL are not detected by Module::Scandeps when it is called by PAR::Packer.

      Net::SSLeay in turn has DLL dependencies that need to be packed.

      If you edit the script to explicitly use Net::SSLeay then pp-autolink detects dependencies of libcrypto, libssl and zlib.

      pp_autolink -o sendemail.exe sendemail.pl DLL check iter: 1 DLL check iter: 2 DLL check iter: 3 No alien system dlls detected Detected link list: --link c:\berrybrew\5.28.0_64_pdl\c\bin/libcrypto- +1_1-x64__.dll --link c:\berrybrew\5.28.0_64_pdl\c\bin/libssl-1_1-x64_ +_.dll --link c:\berrybrew\5.28.0_64_pdl\c\bin/zlib1__.dll CMD: pp --link c:\berrybrew\5.28.0_64_pdl\c\bin/libcrypto-1_1-x64__.dl +l --link c:\berrybrew\5.28.0_64_pdl\c\bin/libssl-1_1-x64__.dll --link + c:\berrybrew\5.28.0_64_pdl\c\bin/zlib1__.dll -o sendemail.exe sendem +ail.pl

        Hi swl,

        Many thanks for your input! I think we are making progress here.

        I am now getting the below error instead.

        Can't locate object method "start_SSL" via package "IO::Socket::SSL" at script/sendemail.pl line 474.

          It seems that a plain pp call, even with the -x flag, does not trigger all of the libraries, but packing works under pp_autolink.

          You could also add these lines to the script, assuming in your case you always want to use them anyway:

          BEGIN { use Net::SSLeay; use IO::Socket::SSL; IO::Socket::SSL->start_SSL($SERVER, SSL_version => 'TLSv1_2', SSL_ +verify_mode => 0 ); }

          When I run the exe I can get the usage information.

          However, I have not tested if sending emails actually works, and that might be the next point of failure, leading to your other reply in 11131180.

        I think this program is far too old and too broken to fix.

        I am also not a developer or a Perl user. Time to look for an alternative.

        Thank you all for your input, this is such a great community, I have learned a couple of things about Perl :D

        EDIT: With swl's help, TLSv1.2 and TLSv1.3 are now working as expected in sendMail.exe after packing it with pp_autolink

    Re: pp generated executable can't find or load libraries
    by Discipulus (Abbot) on Apr 10, 2021 at 17:27 UTC
      Hello vexed and welcome to the monastery and to the wonderful world of Perl!

      your issue seems not so easy: your

      > SYSTEM ERROR in executing sendEmail.pl : 256 at C:/Perl/perl/site/lib/Module/ScanDeps.pm line 1503

      is when Module::ScanDeps try to perl -c what it received.

      This can be related to one of modules you are trying to load because Net::SSLeay is bit particular: Re^3: PAR::Packer - 'dll not found' error on run.

      So I cant resolve atm your pp issue with this script.

      Anyway to send mail using perl is by far easier than debug the problem you are facing :) so consider well your needs to see if you can just embed or create your own mailsender routine.

      PS see also PAR and pp in my bibliotheca dedicated section.

      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.

        Thank you for your reply Discipulus,

        I have managed to check the original executable from 2009 using depends.exe (on an old Windows 7 PC) and it is very different compared to the one I packaged, it seems to have been packaged using Perl 5.8. In anyway, I assumed it is a straight forward issue but I was wrong. Thanks for your time.
          hello again vexed,

          I suppose you'll like Dependencies :)

          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.
    Re: pp generated executable can't find or load libraries
    by Lotus1 (Vicar) on Apr 12, 2021 at 14:19 UTC
      I have used pp with -M Net::SSLeay -M IO::Socket::SSL.

      What happens when you include these modules like this? This is what I would try first.

        Hi Lotus1,

        Same issue, it complains about the missing libraries if I use TLS.

          You can add dll libraries by using -l library.dll. Keep running pp and adding dll's until you have them all. Have a look at the pp Options section for more about -l.

    Re: pp generated executable can't find or load libraries
    by perlfan (Vicar) on Apr 11, 2021 at 21:31 UTC
      What's your requirement? That is be installed on Windows as a standalone program or that you can send email on Windows using a Perl script? You seem to be over complicating it with this bit-rotten program. So if you're looking for options; give us the constraints and look into any suggestions you get. In 2021, sending email is pretty darn easy with a number of useful and easy to use modules on CPAN.

        Hi perlfan,

        My requirement is to get sendemail.exe to be installed on Windows as a standalone program with TLSv1.2 support. I know there is a million way to send emails but unfortunately the original sendEmail.exe v1.56 from 2009 is used in a legacy (old and complicated) app, and I was simply hoping to package it with TLSv1.2 support to avoid the need to update the legacy app.
    Re: pp generated executable can't find or load libraries
    by Anonymous Monk on Apr 12, 2021 at 22:49 UTC
        Hi, I have just tried ppsimple after a battle to install Wx, it generated the largest packed exe, yet the exe fails to load libraries when using TLS.
          Heh. Wx is not a prerequisite. Fail to load is not diagnostic.