develooper Front page | perl.perl5.porters | Postings from December 2008

RE: [perl #61492] ExtUtils::MM_Win32 should not generate "mt" command when CRT is statically linked

Thread Previous | Thread Next
Steve Hay
December 19, 2008 02:01
RE: [perl #61492] ExtUtils::MM_Win32 should not generate "mt" command when CRT is statically linked
Message ID:
Erland Sommarskog (via RT) wrote:
> ExtUtils::MM_Win32 includes these lines:
>       # VS2005 (aka VC 8) or higher, but not for 64-bit compiler from
>       Platform SDK if ($Config{ivsize} == 4 && $Config{cc} eq 'cl'
>     and $Config{ccversion} =~ /^(\d+)/ and $1 >= 14) {
>         push(@m,
>           q{
>    mt -nologo -manifest $@.manifest -outputresource:$@;2 && del
>       $@.manifest}); }
> I am told the that "mt" command is there, because VC8 and later
> generates a manifest 
> file that is needed to use the MSVCRT80.DLL or corresponding file.
> However, if you opt to link statically to the CRT and thus include
> the CRT routines in 
> your own DLL, VC80 will not generate any manifest file, and the "mt"
> command and thus 
> the entire build will fail.
> Note that there are several options to request static linkage:
> /MT,/MTd and a couple more. 

What is it that you're static-linking to the CRT?

I see from your perl -V output:

>   Compiler:
>     cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
>     -O1', cppflags='-DWIN32' ccversion='15.0.30729', gccversion='',

that you've built perl with the -MD option (for dynamic-linking the
MSVCR*.dll) [and, indeed, that's the only option available in perl's
win32/Makefile], so EU::MM just assumes that when you're building XS
extensions you're using the same build options.

I'm not even sure I understand how you've told EU::MM to static-link the
CRT. I thought if you're using EU::MM to build anything then it just
automatically uses the perl build options. Can we see a sample Makefile
that exhibits the problem?

I'm also always slightly uneasy about mix'n'match-ing different CRTs. If
one component (exe/dll) is built using MSVCR*.dll, then I'd always
prefer all the other components to do likewise, rather than having some
others built with LIBC.lib or whatever.

Is it possible for you to build everything with -MD, like EU::MM is
expecting anyway?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About