Sisyphus wrote:
> I don't think there is a %Config key that contains the compile-only switch.
> However, there is a fairly simple solution to your problem. The problem is
> not so much that 'cl' wants to link as well as compile. It's just that 'cl',
> in creating the executable (test.obj) needs to first create an object file
> with exactly the same name ... and that's what it's complaining about.
Thanks for the insight; it never ceases to amaze me the depths of stupidity that
Micro$oft is capable of maintaining over such an extended time. :(
I think that I'm going to reverse myself and apply a platform-dependent fix
here; the compiler has no business calling the linker unless configured to do
so. Looking carefully at ExtUtils::CBuilder::Platform::Windows, I see that
build_compiler_command() always includes '-c' manually (when using MSVC), so
that is what I'll do as well.
Can you do me a big favor and confirm that this works?
=== Makefile.PL
==================================================================
--- Makefile.PL (revision 227)
+++ Makefile.PL (local)
@@ -125,7 +129,12 @@
close F or return 0;
- system( "$Config{cc} -o test$Config{obj_ext} test.c" ) and return 0;
+ my $cc = $Config{cc};
+ if ( $cc =~ /cl(\.exe)?$/ ) { # stupid stupid MSVC compiler
+ $cc .= ' -c'; # prevent it from calling the linker
+ }
+ system( "$cc -o test$Config{obj_ext} test.c" ) and return 0;
+
return 1;
}
TIA
John