Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 67311
Status: resolved
Priority: 0/
Queue: PAR-Packer

People
Owner: RSCHUPP [...] cpan.org
Requestors: pnewkirk [...] cdrg.org
yz [...] pereslavl.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.009
Fixed in: (no value)



Subject: missing dll
I have built a simple 'Hello World!' Perl program into an executable using pp -o mytest.exe mytest.pl. This runs fine when the PATH includes the C compiler directory, but if I run it without I get the message 'The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Try reinstalling the program to fix this problem.' Including the library with the -l option has no outward effect, though it is included in the executable (I've unzipped it to verify) and does appear to go into the cache directory (in Par::Packer version 1.008 it was under the inc/shlib subdirectory, and in version 1.009 it is in the main directory). I am running: -Windows 7 Professional -ActivePerl 5.12.3 (32 bit) -MinGW gcc 4.5.2 (where the libgcc_s_dw2-1.dll is from) -PAR 1.002 -Module-ScanDeps 1.02 -PAR-Packer 1.009 Background: I'm looking to build some programs to simplify my organization's internal processes. No one else is familiar with Perl or C, and I can't make people learn or install it on their computers. In the event that I'm away and can't run the processes, I could leave programs to run with simple instructions. pp seems to be a good solution so that I can use Perl, except for this issue. I filed this on the CPAN forum for PAR::Packer, and Roderich's response was: ...it's a bug in PAR::Packer. Please file a report at rt.cpan.org (for distribution "PAR-Packer") so that it doesn't get lost - basically cut+paste your post here. Shouldn't be too hard to fix, because the mechanism to pack some libgcc_*.dll is already there, but it expects this DLL to be in the same directory as perl.exe itself.
On 2011-04-07 14:12:51, pnewkirk wrote: Show quoted text
> Shouldn't be too hard to fix, because the mechanism to pack some > libgcc_*.dll is already there, but it expects this DLL to be in the same > directory as perl.exe itself.
Not a proper fix, more of a band-aid that should keep you going: - unpack a fresh tarball of PAR::Packer - apply the attached patch - perl Makefile.PL, ..., dmake install # you know the drill - re-pack your script and try the resulting executable Cheers, Roderich
Subject: 67311-band-aid.patch
--- myldr/Makefile.PL.orig 2011-04-11 15:51:02.000000000 +0200 +++ myldr/Makefile.PL 2011-04-11 16:03:58.000000000 +0200 @@ -207,10 +207,11 @@ if ($dynperl and $^O eq 'MSWin32' and defined $Config{gccversion} # gcc version 4.x or above was used and $Config{gccversion} =~ m{\A(\d+)}ms && $1 >= 4) { - # look for a libgcc_*.dll in the same directory - # as the perl executable itself - ($libgcc) = glob(File::Spec->catfile(File::Basename::dirname($^X), - "libgcc_*.$Config{so}")); + # look for a libgcc_*.dll: + # - in the same directory as the perl executable itself + # - in the same directory as gcc + ($libgcc) = map { glob(File::Spec->catfile(File::Basename::dirname($_), "libgcc_*.$Config{so}")) } + $^X, $cc; } $libgcc ||= "";
Yakov Zaidelman wrote (for duplicate bug #67746): Show quoted text
> - pp hello.pl -o hello.exe > If I do the last command when compiler directory (C:\MinGW\bin) > is in the PATH it works OK. > If I do it without that directory in the PATH I get an error message. > If I create hello.exe it works OK while compiler directory > remains in PATH. But if I remove it from PATH I get the same message.
Definitively the same bug as this one. I've attached an even bigger band-aid. Make sure that you do a clean build (with the patch applied) + re-install of PAR::Packer. If it doesn't work for you, please post the complete build log. Cheers, Roderich
Subject: 67311-bigger-band-aid.patch
--- myldr/Makefile.PL.orig 2011-04-26 08:40:32.000000000 +0200 +++ myldr/Makefile.PL 2011-04-26 08:44:42.000000000 +0200 @@ -203,10 +203,14 @@ if ($dynperl and $^O eq 'MSWin32' and defined $Config{gccversion} # gcc version 4.x or above was used and $Config{gccversion} =~ m{\A(\d+)}ms && $1 >= 4) { - # look for a libgcc_*.dll in the same directory - # as the perl executable itself - ($libgcc) = glob(File::Spec->catfile(File::Basename::dirname($^X), - "libgcc_*.$Config{so}")); + # look for a libgcc_*.dll + # - in PATH + # - in the same directory as the perl executable itself + # - in the same directory as gcc + ($libgcc) = map { glob(File::Spec->catfile($_, "libgcc_*.$Config{so}")) } + File::Spec->path(), + File::Basename::dirname($^X), + File::Basename::dirname($cc); } $libgcc ||= "";
Subject: Re: [rt.cpan.org #67311] missing dll
Date: Tue, 26 Apr 2011 12:57:25 +0400
To: Roderich Schupp via RT <bug-PAR-Packer [...] rt.cpan.org>
From: Yakov Zaidelman <yz [...] pereslavl.ru>
[Roderich Schupp via RT 26.04.2011 12:08] [[rt.cpan.org #67311] missing dll] Show quoted text
RSvR> I've attached an even bigger band-aid. Make sure that you do RSvR> a clean build (with the patch applied) + re-install of PAR::Packer. RSvR> If it doesn't work for you, please post the complete build log.
Build log attached.
Download PAR-Packer-1.009-buildlog.zip
application/x-zip-compressed 2.4k

Message body not shown because it is not plain text.

On 2011-04-26 04:57:35, yz@pereslavl.ru wrote: Show quoted text
> Build log attached.
Logs look OK, esp. libgcc_*.dll is packed into boot.exe Show quoted text
> - pp hello.pl -o hello.exe > If I do the last command when compiler directory (C:\MinGW\bin) > is in the PATH it works OK. > If I do it without that directory in the PATH I get an error message.
This can't be helped: in genereal, any executable linked with gcc may have a reference to libgcc_*.dll, hence this DLL must be in PATH somewhere. Show quoted text
> If I create hello.exe it works OK while compiler directory > remains in PATH. But if I remove it from PATH I get the same message.
This should work now. If not: - did you re-run "pp hello.pl -o hello.exe" after installing the patched PAR::Packer? - please post the output of objdump -ax hello.exe | find "DLL" objdump -ax myldr\boot.exe | find "DLL"
Subject: Re: [rt.cpan.org #67311] missing dll
Date: Tue, 26 Apr 2011 18:55:59 +0400
To: Roderich Schupp via RT <bug-PAR-Packer [...] rt.cpan.org>
From: Yakov Zaidelman <yz [...] pereslavl.ru>
[Roderich Schupp via RT 26.04.2011 16:35] [[rt.cpan.org #67311] missing dll] Show quoted text
>> - pp hello.pl -o hello.exe >> If I do the last command when compiler directory (C:\MinGW\bin) >> is in the PATH it works OK. >> If I do it without that directory in the PATH I get an error message.
Show quoted text
RSvR> This can't be helped: in genereal, any executable linked with gcc RSvR> may have a reference to libgcc_*.dll, hence this DLL must be in RSvR> PATH somewhere.
I use pp to create exe from perl about two years. I never had C compiler in the PATH and never had problems. There always was a warning (You don't have a C compiler on your PATH) but an exe-file was successfully created and executed on my computer and on computers without any perl or C. Yesterday I had to re-install Perl. So I have installed the latest available versions of ActivePerl and the modules. The Win32::Exe (required by PAR::Packer) did not pass tests after build. I have found this bug in the buglist: it was said that this happens because of the gcc bug. So I had to reinstall MinGW using the latest version. After that all the necessary modules were successfully built, but I cannot create exe and start it without compiler directory in PATH. Show quoted text
>> If I create hello.exe it works OK while compiler directory >> remains in PATH. But if I remove it from PATH I get the same message.
Show quoted text
RSvR> This should work now. If not: RSvR> - did you re-run "pp hello.pl -o hello.exe" after installing the RSvR> patched PAR::Packer?
It does not work. I create hello.exe after each installation of PAR::Packer. Show quoted text
RSvR> - please post the output of
Show quoted text
RSvR> objdump -ax hello.exe | find "DLL" RSvR> objdump -ax myldr\boot.exe | find "DLL"
The result is absolutely identical for both files. I have attached both output files and (just in case it may be useful) fragments from full objdump -ax output.
Download objdump.zip
application/x-zip-compressed 978b

Message body not shown because it is not plain text.

On 2011-04-26 10:56:10, yz@pereslavl.ru wrote: Show quoted text
> I use pp to create exe from perl about two years. > I never had C compiler in the PATH and never had problems. > There always was a warning (You don't have a C compiler on your PATH) > but an exe-file was successfully created and executed on my computer > and on computers without any perl or C.
FYI: In general, you need (and always needed) a C compiler to build PAR::Packer. But failing that "perl Makefile.PL" tries to find a pre-built PAR::Packer on CPAN that matches your installation. In the past you just got lucky that it found one. Show quoted text
> RSvR> - please post the output of > RSvR> objdump -ax myldr\boot.exe | find "DLL"
> > DLL Name: ADVAPI32.DLL > DLL Name: KERNEL32.dll > DLL Name: msvcrt.dll > DLL Name: msvcrt.dll > DLL Name: libgcc_s_dw2-1.dll
The last line explains what your seeing: boot.exe is linked against libgcc_s_dw2-1.dll and hence needs it to be present in PATH to run. Same goes for all pp'ed executables because they basically consist of boot.exe concatenated with a PAR file. AFAICT there is no need to link boot.exe against libgcc_*.dll. Looking at your build log, the most likely suspect is this line: C:\MinGW\bin\g++.exe boot.o ... -o boot.exe i.e. using g++ as linker (instead of gcc). That will probably include support for exception handling which pulls in libgcc. Now "C:\MinGW\bin\g++.exe" is just Config{ld} from your Config.pm. Hmm... I understand why ActiveState wants to link "as C++" and that's correct for linking par.exe (which is a special-purpose Perl interpreter), but unfortunately not for boot.exe (which is a standalone executable that has nothing to do with Perl). Please try the patch below (on top of the previous patch) and check if it makes the reference to libgcc*.dll in boot.exe go away. --- myldr/Makefile.PL.orig 2011-04-26 08:40:32.000000000 +0200 +++ myldr/Makefile.PL 2011-04-27 10:16:26.000000000 +0200 @@ -320,7 +324,7 @@ boot$o: \$(MKTMP_STUFF) $my_stuff $boot_exe: boot$o - \$(LD) boot$o \$(STATIC_LDFLAGS) $res $out$boot_exe_link + \$(CC) boot$o \$(STATIC_LDFLAGS) $res $out$boot_exe_link $mt_cmd \$(PERLRUN) parlsig.pl $boot_exe $par_exe $dynperl $chunk_size Cheers, Roderich
Subject: Re: [rt.cpan.org #67311] missing dll
Date: Wed, 27 Apr 2011 19:17:59 +0400
To: Roderich Schupp via RT <bug-PAR-Packer [...] rt.cpan.org>
From: Yakov Zaidelman <yz [...] pereslavl.ru>
Show quoted text
RSvR> FYI: In general, you need (and always needed) a C compiler RSvR> to build PAR::Packer. But failing that "perl Makefile.PL" tries RSvR> to find a pre-built PAR::Packer on CPAN that matches your installation. RSvR> In the past you just got lucky that it found one.
I understand that and use special environment when building modules. My point was that I have no C in PATH when using pp and exe-files created with pp. Show quoted text
RSvR> Please try the patch below (on top of the previous patch) RSvR> and check if it makes the reference to libgcc*.dll in boot.exe RSvR> go away.
It really helped. Reference disappeared, exe-file was successfully created and started without C in PATH. Great thanks!
On 2011-04-27 11:18:12, yz@pereslavl.ru wrote: Show quoted text
> It really helped. Reference disappeared, exe-file was successfully > created and started without C in PATH.
Great! Thanks for testing. I've committed the patch, will be in the next release of PAR::Packer. Cheers, Roderich
Subject: RE: [rt.cpan.org #67311] Resolved: missing dll
Date: Tue, 10 May 2011 12:47:07 -0500
To: "bug-PAR-Packer [...] rt.cpan.org" <bug-PAR-Packer [...] rt.cpan.org>, "yz [...] pereslavl.ru" <yz [...] pereslavl.ru>
From: "Paul L. Newkirk" <PNewkirk [...] cdrg.org>
I'll confirm that the two patches worked to resolve my issue as well. Sorry I haven't been responsive. I'm pretty busy with work, and only get a few moments during the month to 'play' with/research new software solutions. Thanks to both of you for working on this. Show quoted text
-----Original Message----- From: Roderich Schupp via RT [mailto:bug-PAR-Packer@rt.cpan.org] Sent: Wednesday, April 27, 2011 1:30 PM To: Paul L. Newkirk; yz@pereslavl.ru Subject: [rt.cpan.org #67311] Resolved: missing dll <URL: https://rt.cpan.org/Ticket/Display.html?id=67311 > According to our records, your request has been resolved. If you have any further questions or concerns, please respond to this message.

Message body is not shown because sender requested not to inline it.

On 2011-05-10 13:47:20, pnewkirk wrote: Show quoted text
> I'll confirm that the two patches worked to resolve my issue as well. > Sorry I haven't been responsive. I'm pretty busy with work, and only > get a few moments during the month to 'play' with/research new > software solutions. Thanks to both of you for working on this.
No problem, thanks for the confirmation. Cheers, Roderich