From: Vincent Pit Date: Thu, 23 Sep 2010 16:52:42 +0000 (+0200) Subject: Force linking against the perl dll when using gcc 3.4 on Windows X-Git-Tag: v0.44~8 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=14f8af239bcc9baaf072b0eb42422f684906953d;p=perl%2Fmodules%2FVariable-Magic.git Force linking against the perl dll when using gcc 3.4 on Windows When a Windows perl links an XS shared object to an import library using gcc/g++ version 3.4.x, strange breakage happens at load time because the mutex-related symbols seems not to be reachable. This situation happens especially for AS perl and the default compiler suite it installs. We fix this by forcing g++ to link against the dll instead, which should be in the same directory as the perl executable (at least for AS perl). This (should) fix RT #51483. --- diff --git a/Makefile.PL b/Makefile.PL index cef05b2..93598a1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,6 +11,7 @@ BEGIN { } my @DEFINES; +my %macro; my $pl = $Config{perl_patchlevel}; print "Checking perl patchlevel... "; @@ -48,6 +49,25 @@ if ($^V ge v5.11.0 and not defined $pl) { } print $is_5110rel ? "yes\n" : "no\n"; +my $is_gcc_34 = 0; +print "Checking if this is gcc 3.4 on Windows trying to link against an import library... "; +if ($^O eq 'MSWin32' and not grep /^LD[A-Z]*=/, @ARGV) { + my ($libperl, $gccversion) = map $_ || '', @Config{qw/libperl gccversion/}; + if ($gccversion =~ /^3\.4\.[0-9]+/ and $libperl =~ s/\.lib$//) { + $is_gcc_34 = 1; + my ($lddlflags, $ldflags) = @Config{qw/lddlflags ldflags/}; + $_ ||= '', s/-L(?:".*?"|\S+)//g for $lddlflags, $ldflags; + $libperl = "-l$libperl"; + my $libdirs = join ' ', + map { s/(? join ' ', @DEFINES) if @DEFINES; +%macro = (macro => { %macro }) if %macro; # Beware of the circle my $dist = 'Variable-Magic'; @@ -115,4 +136,5 @@ WriteMakefile( clean => { FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt" }, + %macro, );