Markus Jansen
2015-01-23 11:17:01 UTC
Hi Roderich and others,
having Perl built with a shared library named differently, I have found that PAR ceased to work properly.
For some time, my resulting executable had not been static regarding libperl, and with PAR-Packer 1.024, even compilation did not work anymore.
The root cause is that in myldr/Makefile.PL, in one place /\s+-lperl\s+/ gets blindly stripped off from ldflags,
although some lines apart the libperl name is obeyed.
Please find the fix as context diff attached below (unfortunately, you seem to still use subversion).
It would be great to get it into the next PAR-Packer release.
Best regards,
Markus
P.S.: I admit the feature is difficult to test in a standard Perl environment :-).
[src/PAR-Packer-1.024/myldr] -> diff -c Makefile.PL*
*** Makefile.PL Fri Nov 7 09:23:43 2014
--- Makefile.PL.mja_dynperlfix Fri Jan 23 11:12:46 2015
***************
*** 142,150 ****
my $ldflags = "$lddebug$pldflags $perl58lib";
my $static_ldflags = $ldflags;
- $static_ldflags =~ s/\s+-lperl\s+/ /g;
- $boot_ldflags .= $static_ldflags;
-
my $libperl;
if ($dynperl and $^O eq 'os2') {
--- 142,147 ----
***************
*** 169,174 ****
--- 166,182 ----
undef $dynperl if !-e $libperl;
}
+ my $perllibshortname = 'perl';
+ if ($dynperl) {
+ $perllibshortname = basename($libperl);
+ my $so = $Config{so} || 'so';
+ $perllibshortname =~ s/^lib//;
+ $perllibshortname =~ s/\Q.$so\E$//;
+ }
+ $static_ldflags =~ s/\s+-l$perllibshortname\s+/ /g;
+ $boot_ldflags .= $static_ldflags;
+
+
# In the $dynperl case, we've already found the $libperl DSO.
# The only problem is: when the linker links $par_exe against $libperl
# we don't know what name is used to refer to $libperl in the executable
---------------------------- end of context diff ---------------------------
[Ericsson]<http://www.ericsson.com/>
MARKUS JANSEN Dipl.-Ing.
Ericsson
Ericsson Allee 1
52134, Herzogenrath, Germany
Phone +49 2407 575 5157
Mobile +49 172 2742003
Exchange +49 2407 575 0
Fax +49 2407 575 14721
***@ericsson.com
www.ericsson.com
[http://www.ericsson.com/current_campaign]<http://www.ericsson.com/current_campaign>
Legal entity: Ericsson GmbH, registered office in Düsseldorf, Germany, Trade Register: Amtsgericht Düsseldorf (HRB 33012). Managing Directors: Stefan Koetz (Chairman), Cecilia Wachtmeister, Bernd Mellinghaus. Supervisory Board: Valter D'Avino (Chairman). This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>
having Perl built with a shared library named differently, I have found that PAR ceased to work properly.
For some time, my resulting executable had not been static regarding libperl, and with PAR-Packer 1.024, even compilation did not work anymore.
The root cause is that in myldr/Makefile.PL, in one place /\s+-lperl\s+/ gets blindly stripped off from ldflags,
although some lines apart the libperl name is obeyed.
Please find the fix as context diff attached below (unfortunately, you seem to still use subversion).
It would be great to get it into the next PAR-Packer release.
Best regards,
Markus
P.S.: I admit the feature is difficult to test in a standard Perl environment :-).
[src/PAR-Packer-1.024/myldr] -> diff -c Makefile.PL*
*** Makefile.PL Fri Nov 7 09:23:43 2014
--- Makefile.PL.mja_dynperlfix Fri Jan 23 11:12:46 2015
***************
*** 142,150 ****
my $ldflags = "$lddebug$pldflags $perl58lib";
my $static_ldflags = $ldflags;
- $static_ldflags =~ s/\s+-lperl\s+/ /g;
- $boot_ldflags .= $static_ldflags;
-
my $libperl;
if ($dynperl and $^O eq 'os2') {
--- 142,147 ----
***************
*** 169,174 ****
--- 166,182 ----
undef $dynperl if !-e $libperl;
}
+ my $perllibshortname = 'perl';
+ if ($dynperl) {
+ $perllibshortname = basename($libperl);
+ my $so = $Config{so} || 'so';
+ $perllibshortname =~ s/^lib//;
+ $perllibshortname =~ s/\Q.$so\E$//;
+ }
+ $static_ldflags =~ s/\s+-l$perllibshortname\s+/ /g;
+ $boot_ldflags .= $static_ldflags;
+
+
# In the $dynperl case, we've already found the $libperl DSO.
# The only problem is: when the linker links $par_exe against $libperl
# we don't know what name is used to refer to $libperl in the executable
---------------------------- end of context diff ---------------------------
[Ericsson]<http://www.ericsson.com/>
MARKUS JANSEN Dipl.-Ing.
Ericsson
Ericsson Allee 1
52134, Herzogenrath, Germany
Phone +49 2407 575 5157
Mobile +49 172 2742003
Exchange +49 2407 575 0
Fax +49 2407 575 14721
***@ericsson.com
www.ericsson.com
[http://www.ericsson.com/current_campaign]<http://www.ericsson.com/current_campaign>
Legal entity: Ericsson GmbH, registered office in Düsseldorf, Germany, Trade Register: Amtsgericht Düsseldorf (HRB 33012). Managing Directors: Stefan Koetz (Chairman), Cecilia Wachtmeister, Bernd Mellinghaus. Supervisory Board: Valter D'Avino (Chairman). This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>