Hi,

I don't know why missing the '-s' flag from the linker causes failures.
I do know that when the '-s' flag is specified, there's no symbol table in the dll PE image and no need for associated relocation addresses.

The gcc debugging symbols are for most practical purposes useless with ActivePerl I would think. So having '-s' as a standard option isn't a bad thing in itself. It would be nice to understand exactly what is happening though and therefore rule out the possibility of any other problems.

For info, I have tried the 32bit version of mingw-w64 and the debugging symbols cause no difficulty there. I've checked the PE/COFF headers for both 32bit and 64bit DLL's - and the 32 bit version definitely includes debugging symbols if you don't specify -s - and still works. The 64bit DLL must be a valid PE+ (64bit) image, or it would not load at all I would not think.

Anyhow, I combined the flags in your Config.pm file together with details from the Config_heavy.pl produced when Perl itself is compiled with mingw gcc and put it in my Config_w64.pm. I've attached that again for the list's sake as the original was missing a couple of probably important options (already in yours and the AS versions).

Interestingly, the Config_heavy.pl produced when Perl itself is compiled with mingw gcc includes the '-s' flag in the ldflags, and also in optimize - 'optimize' = '-s -O2'. (I'm assuming it has the same meaning here).

For info, the problem may be a symbol name mangling issue. I noticed in the 64 bit PE that some symbol names had been mangled ( e.g _function becomes _funct...@12 ) but far fewer than in the 32bit PE. My brief Googling suggests that the 64 bit symbols should not be mangled / decorated in this way at all - but I don't really know.


regards

Mark



On 20/04/2010 09:34, Sisyphus wrote:

----- Original Message ----- From: "Mark Dootson" <mark.doot...@znix.com>
To: "Sisyphus" <sisyph...@optusnet.com.au>
Cc: "perl-win32-users" <perl-win32-users@listserv.ActiveState.com>
Sent: Monday, April 19, 2010 10:59 PM
Subject: Re: Using mingw64 with x64 ActiveState builds.


Hi,

Did as you suggested and yes, I get same failures as you starting in
01syntax.t

I had a look at differences in config output as your symptom of not
being able to load more than one Math:: library at once sounded like
maybe a linker error with msvcrt?

Anyhow, adding '-s' flag to linker options in your Config.pm seems to
solve 'Inline' building errors

_override("lddlflags", join(" ", "-s -mdll", @libpaths));
_override("ldflags", join(" ", '-s', @libpaths));


Yes, that's it .... brilliant !!! ...and many thanks!!. (Fixes the
problem with the Math:: modules, too.)

Do you know why the absence of the '-s' flag does not have similarly
disastrous consequences with the 32-bit ActiveState builds of perl and
mingw32 ?

Cheers,
Rob
package Config_w64;

require ExtUtils::FakeConfig;

my $cc_p = ( ExtUtils::FakeConfig::find_program( 'gcc' ) )[0];
$cc_p || die "Unable to find compiler 'gcc'";
$cc_p =~ s/[\\\/]bin[\\\/]?$//;

my $dmake = ( ExtUtils::FakeConfig::find_program( 'dmake' ) )[1];
$dmake || die "Unable to find dmake";

my $CONFIGPERL = $Config::Config{prefix};

my($ccflags, $libs, $perllibs, $libperl, $archlib);

my $arch = $Config::Config{archname};
my $bperllib = $Config::Config{libperl};

$ccflags = ' -DNDEBUG -O2 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT 
-DCONSERVATIVE -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX 
-DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields';
$libs    = ' -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr 
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt';
$perllibs = $libs;

if( ($bperllib eq 'perl58.lib') && ($arch eq 'MSWin32-x64-multi-thread' ) ){
    # perl 5.8 x64
    $ccflags  .= ' -DWIN64 -DNO_HASH_SEED';
    $libperl  = 'libperl58.a';
    $archlib  = 'x86_64-w64-mingw32';
    
} elsif( ($bperllib eq 'perl510.lib') && ($arch eq 'MSWin32-x64-multi-thread' ) 
) {
    # perl 5.10 x64
    $ccflags  .= ' -DWIN64';
    $libperl  = 'libperl510.a';
    $archlib  = 'x86_64-w64-mingw32';
    
} elsif( ($bperllib eq 'perl512.lib') && ($arch eq 'MSWin32-x64-multi-thread' ) 
) {
    # perl 5.12 x64
    $ccflags  .= ' -DWIN64';
    $libperl  = 'libperl512.a';
    $archlib  = 'x86_64-w64-mingw32';
    
}  elsif( ($bperllib eq 'perl58.lib') && ($arch eq 'MSWin32-x86-multi-thread' ) 
) {
    # perl 5.8 x86
   $ccflags  .= ' -DNO_HASH_SEED';
   $libperl  = 'libperl58.a';
   $archlib  = 'i686-w64-mingw32';
   
}  elsif( ($bperllib eq 'perl510.lib') && ($arch eq 'MSWin32-x86-multi-thread' 
) ) {
    # perl 5.10 x86
   $libperl  = 'libperl510.a';
   $archlib  = 'i686-w64-mingw32';
   
}  elsif( ($bperllib eq 'perl512.lib') && ($arch eq 'MSWin32-x86-multi-thread' 
) ) {
    # perl 5.12 x86
   $libperl  = 'libperl512.a';
   $archlib  = 'i686-w64-mingw32';

} else {
    die qq(Archname $arch and perllib $bperllib is not supported by Config_w64);
}

my %values = (
    cc          => 'gcc',
    ccname      => 'gcc',
    ccflags     => $ccflags,
    _a          => '.a',
    _o          => '.o',
    ar          => 'ar',
    cpp         => 'gcc -E',
    libpth      => qq(\"$cc_p\\lib\" \"$cc_p\\$archlib\\lib\"),
    cppminus    => '-',
    cpprun      => 'gcc -E',
    cppstdin    => 'gcc -E',
    ld          => 'g++',
    lddlflags   => qq(-s -mdll -L\"$CONFIGPERL\\lib\\CORE\"),
    ldflags     => qq(-s -L\"$CONFIGPERL\\lib\\CORE\"),
    lib_ext     => '.a',
    libc        => '-lmsvcrt',
    libperl     => $libperl,
    make        => $dmake,
    nm          => 'nm',
    obj_ext     => '.o',
    optimize    => '-s -O2',
    libs        => $libs,
    perllibs    => $perllibs,
    i64type     => 'long long',
    u64type     => 'unsigned long long',
    quadtype    => 'long long',
    uquadtype   => 'unsigned long long',
    d_casti32   => 'define',    
);

eval 'use ExtUtils::FakeConfig %values';

1;
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to