This queue is for tickets about the Compress-Bzip2 CPAN distribution.

Report information
The Basics
Id:
105096
Status:
patched
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
HMBRAND [...] cpan.org
Cc:
AdminCc:

BugTracker
Severity:
Critical
Broken in:
  • 2.11
  • 2.12
  • 2.13
  • 2.14
  • 2.15
  • 2.16
  • 2.17
  • 2.18
  • 2.19
  • 2.20
  • 2.22
Fixed in:
(no value)



Subject: linker flags are wrong when loader != $CC
ccdlflags is designed to pass the loader flags to $CC (as correctly used on line ±185 - after patch), not when $Config{ld} is not $CC, which will cause link failures like Running Mkbootstrap for Compress::Bzip2 () chmod 644 "Bzip2.bs" "/opt/perl32/bin/perl" "/opt/perl32/lib/5.22.0/ExtUtils/xsubpp" -typemap "/opt/perl32/lib/5.22.0/ExtUtils/typemap" -typemap "typemap" Bzip2.xs > Bzip2.xsc && mv Bzip2.xsc Bzip2.c gcc -c -Ibzlib-src -mpa-risc-2-0 -fPIC -DPERL_DONT_CREATE_GVSV -D_HPUX_SOURCE -fwrapv -fno-strict-aliasing -pipe -I/usr/local/pa20_32/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -O -DVERSION=\"2.22\" -DXS_VERSION=\"2.22\" -fPIC "-I/opt/perl32/lib/5.22.0/PA-RISC2.0/CORE" Bzip2.c rm -f blib/arch/auto/Compress/Bzip2/Bzip2.sl /usr/bin/ld -b -L/usr/local/pa20_32/lib -L/usr/local/lib -L/pro/local/lib -Wl,-E -Wl,-B,deferred Bzip2.o -o blib/arch/auto/Compress/Bzip2/Bzip2.sl bzlib-src/libbz2.a \ \ /usr/bin/ld: Unrecognized argument: -Wl,-E /usr/bin/ld: Usage: /usr/bin/ld [options] [flags] files I think that a safe workaround would be something like this: --8<--- --- /tmp/Makefile.PL 2015-06-08 18:23:44 +0200 +++ Makefile.PL 2015-06-08 18:20:29 +0200 @@ -24,6 +24,15 @@ ParseCONFIG() ; my %Bzip2 = ( pm => catfile( qw( lib Compress Bzip2.pm ) ), lib => catfile( 'bzlib-src', 'libbz2'.$Config{_a} ) ); +my $dlflags = $Config{ccdlflags}; +if ($Config{ld} =~ m{^(.*/)?\w*ld\w*$}) { + my @flags; + for (split m/\s+/ => $dlflags) { + s/^-Wl,(-+[-\w]+),/$1 / or s/^-Wl,//; + push @flags, $_; + } + $dlflags = join " " => @flags; + } # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( @@ -45,7 +54,7 @@ WriteMakefile( AUTHOR => 'Rob Janes <arjay@cpan.org>') : ()), LIBS => $BUILD_BZLIB ? [] : [ $BZLIB_LIB ? "-L$BZLIB_LIB -lbz2" : '-lbz2' ], # ccdlflags needed for -R [cpan #68572] - LDDLFLAGS => $Config{lddlflags} . " " . $Config{ccdlflags}, + LDDLFLAGS => $Config{lddlflags} . " " . $dlflags, INC => $BUILD_BZLIB ? '-Ibzlib-src' : $BZLIB_INCLUDE ? "-I$BZLIB_INCLUDE" : '', clean => { FILES=> -->8--- which at least makes Compress::Bzip2 work out-of-the-box on all my HP-UX boxes. Feel free to apply your own style of course
Thanks, your patch looks good. Works ok on all my darwin perls, but I need some time to test it on all my other systems. I'm on YAPC:NA right now. Will upload it next week. The patch is on github. https://github.com/rurban/Compress-Bzip2/commits/2.23 On Mon Jun 08 12:29:53 2015, HMBRAND wrote:
Show quoted text
> ccdlflags is designed to pass the loader flags to $CC (as correctly > used on line ±185 - after patch), not when $Config{ld} is not $CC, > which will cause link failures like > > Running Mkbootstrap for Compress::Bzip2 () > chmod 644 "Bzip2.bs" > "/opt/perl32/bin/perl" "/opt/perl32/lib/5.22.0/ExtUtils/xsubpp" > -typemap "/opt/perl32/lib/5.22.0/ExtUtils/typemap" -typemap "typemap" > Bzip2.xs > Bzip2.xsc && mv Bzip2.xsc Bzip2.c > gcc -c -Ibzlib-src -mpa-risc-2-0 -fPIC -DPERL_DONT_CREATE_GVSV > -D_HPUX_SOURCE -fwrapv -fno-strict-aliasing -pipe > -I/usr/local/pa20_32/include -D_LARGEFILE_SOURCE > -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -g -O -DVERSION=\"2.22\" > -DXS_VERSION=\"2.22\" -fPIC "-I/opt/perl32/lib/5.22.0/PA-RISC2.0/CORE" > Bzip2.c > rm -f blib/arch/auto/Compress/Bzip2/Bzip2.sl > /usr/bin/ld -b -L/usr/local/pa20_32/lib -L/usr/local/lib > -L/pro/local/lib -Wl,-E -Wl,-B,deferred Bzip2.o -o > blib/arch/auto/Compress/Bzip2/Bzip2.sl bzlib-src/libbz2.a \ > \ > > /usr/bin/ld: Unrecognized argument: -Wl,-E > /usr/bin/ld: Usage: /usr/bin/ld [options] [flags] files > > > I think that a safe workaround would be something like this: > --8<--- > --- /tmp/Makefile.PL 2015-06-08 18:23:44 +0200 > +++ Makefile.PL 2015-06-08 18:20:29 +0200 > @@ -24,6 +24,15 @@ ParseCONFIG() ; > my %Bzip2 = ( pm => catfile( qw( lib Compress Bzip2.pm ) ), > lib => catfile( 'bzlib-src', 'libbz2'.$Config{_a} ) ); > > +my $dlflags = $Config{ccdlflags}; > +if ($Config{ld} =~ m{^(.*/)?\w*ld\w*$}) { > + my @flags; > + for (split m/\s+/ => $dlflags) { > + s/^-Wl,(-+[-\w]+),/$1 / or s/^-Wl,//; > + push @flags, $_; > + } > + $dlflags = join " " => @flags; > + } > # See lib/ExtUtils/MakeMaker.pm for details of how to influence > # the contents of the Makefile that is written. > WriteMakefile( > @@ -45,7 +54,7 @@ WriteMakefile( > AUTHOR => 'Rob Janes <arjay@cpan.org>') : ()), > LIBS => $BUILD_BZLIB ? [] : [ $BZLIB_LIB ? "- > L$BZLIB_LIB -lbz2" : '-lbz2' ], > # ccdlflags needed for -R [cpan #68572] > - LDDLFLAGS => $Config{lddlflags} . " " . $Config{ccdlflags}, > + LDDLFLAGS => $Config{lddlflags} . " " . $dlflags, > INC => $BUILD_BZLIB ? '-Ibzlib-src' : $BZLIB_INCLUDE > ? "-I$BZLIB_INCLUDE" : '', > clean => { > FILES=> > -->8--- > > which at least makes Compress::Bzip2 work out-of-the-box on all my HP- > UX boxes. > Feel free to apply your own style of course
-- Reini Urban
maybe even safer to check if $Config{cc} ne $Config{ld} before checking the *content* of $Config{ld} +my $dlflags = $Config{ccdlflags}; +if ($Config{cc} ne $Config{ld} && $Config{ld} =~ m{^(.*/)?\w*ld\w*$}) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.