On Thu, Jun 10, 2010 at 12:00 PM, Ulli Horlacher
<[email protected]> wrote:
> Instead of
>
>  "This application has failed to start because libeay32_.dll was not found."
>
> I get
>
>  "This application has failed to start because libssl32_.dll was not found."
>
> One step further!
>
> Then I copied libssl32_.dll, too ...and... my application is starting!

This is a known problem and it's very hard to fix:
XS modules are typically there to bind a C library, say libfoo.dll to
Perl. The script will have

use Foo;

and we will look for a file Foo.pm. But then there's also a "glue"
library Foo.dll which
is linked against the actual libfoo.dll. PAR::Packer (actually
Module::ScanDeps) will
detect the dependency on Foo.pm and Foo.dll (because we can learn that from
Perl stuff), but it doesn't detect the dependency on libfoo.dll. So
the first two items
will be packed, but the last one not.

There is _nothing_ in Perl housekeeping information to detect libfoo.dll.
What's needed is highly platform dependent code to glean that information
from Foo.dll. E.g. on Linux you could

$ readelf -d Foo.so

and then grep its output for NEEDED libraries.  But you can't even assume that
any Linux has the readelf utility installed. On Solaris you could
assume that /usr/ccs/bin/dump
is installed, but it has a different output format. On Windows I
dunno, Strawberry has
AFAICT "objdump -ax" (again slightly different output from readelf), but
ActiveState does not come with it (or similar) etc

Unfortunately the Perl core has zero tools for this kind of analysis -
it does a little
of the same investigation during the configure phase of a Perl build,
but it stores
only the results (in Config.pm) for later perusal in the installed
version of Perl.
AFAIK there's no module on CPAN that does this (but I'd be happy if you
prove me wrong).

And this is only the start: once we know that we should look out for libfoo.dll,
we must actually find this file. This means duplicating the library
search algorithm
for the platform. If we've finally found libfoo.dll, we have to repeat
the algorithm
for it (in your example: libeay32_dll depends on libssl_32.dll).
And finally we need some criterion whether to actually pack libfoo.dll
or not. Because on *nix systems, most of these libraries would probably be
"system libraries", i.e. installed in /lib or /usr/lib, and should
_not_ be packed, because
we may assume that they are present on the target machine. Same on Windows:
if libeay32_.dll depends on kernel32.dll, we should _not_ pack
kernel32.dll because
it comes with Windows.

So presently your only option is: pack and try on another machine, if
a library is
missing, add it to the packed exeutable with -l, rinse and repeat.

> But after a while I get a runtime error:
>
>  "Can't locate unicore/Heavy.pl in @INC (...) at utf8_heavy.pl line 96"

That's a known problem, cf. #58093. Fixed in Module::Scandeps trunk, but
not released yet.

> which does not appear when I start schwuppdiwupp.exe on the Windows with
> the installed strawberry perl.

The dependency is not detected, hence the file is not packed.

> I then tried:
>
> pp -gui -clean -o schwuppdiwupp.exe schwuppdiwupp.pl 
> c:\strawberry\perl\lib\unicore\Heavy.pl
>
> but with the same result:

Now you explicitly pack the file, but it's stored (internally) in a
different location where
it won't be found at runtime. Anyway, apply the patch from #58093 (and re-pack).

Cheers, Roderich

Reply via email to