Subject: | adding compiler option after /link for Visual C (aka cl) |
Devel::CheckLib 0.699_001 fails tests with VC++ 6.0 since it adds /I
options after the
/link option on the cl command-line.
The following (also attached) patch fixes the issue.
I've also attached traces of the custom-function.t test before and after
the patch and of the demo.pl script also attacked.
tony@mars:.../Imager/inc$ svn diff -r1613
Index: Devel/CheckLib.pm
===================================================================
--- Devel/CheckLib.pm (revision 1613)
+++ Devel/CheckLib.pm (working copy)
@@ -266,9 +266,9 @@
$cfile,
"${lib}.lib",
"/Fe$exefile",
+ (map { '/I'.Win32::GetShortPathName($_) } @incpaths),
"/link",
(map {'/libpath:'.Win32::GetShortPathName($_)} @libpaths),
- (map { '/I'.Win32::GetShortPathName($_) } @incpaths)
);
} elsif($Config{cc} eq 'CC/DECC') { # VMS
} elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland
Subject: | checklib_trace.txt |
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>perl -Mblib demo.pl
# E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibPUvgBrX7.c /FeassertlibdI
I9Fr0m.exe /Ic:\tifflib\include
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
assertlibPUvgBrX7.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:assertlibdII9Fr0m.exe
assertlibPUvgBrX7.obj
# E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlib1oncaDeR.c libtiff.lib /F
eassertlibCTjC35dW.exe /link /libpath:c:\tifflib\lib /Ic:\tifflib\include
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
assertlib1oncaDeR.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:assertlibCTjC35dW.exe
/libpath:c:\tifflib\lib
/Ic:\tifflib\include
assertlib1oncaDeR.obj
libtiff.lib
LINK : warning LNK4044: unrecognized option "Ic:\tifflib\include"; ignored
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>nmake test TEST_FILES=t/cust
om-function.t
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
H:\Perl\bin\perl.exe -MExtUtils::Command -e cp bin/use-devel-checklib bl
ib\script\use-devel-checklib
pl2bat.bat blib\script\use-devel-checklib
H:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl
ib\lib', 'blib\arch')" t/custom-function.t
t/custom-function....ok 1/5
t/custom-function....NOK 2# Failed test 'failed to build: wrong result'
# at t/custom-function.t line 75.
#
# incpath => 't/inc',
# libpath => 'H:\DOCUME~1\tony\LOCALS~1\Temp\vS8UwTChvI',
# lib => 'bazbam',
# header => 'headerfile.h',
# # libversion returns wrong result
# function => 'foo();if(libversion() < 5) return 0; else return 1;'
#
# Can't link/include 'bazbam'
#
# STDOUT: assertlibyRgh8m9y.c
# Microsoft (R) Incremental Linker Version 6.00.8447
# Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
#
# /out:assertlibgd82EAm7.exe
# assertlibyRgh8m9y.obj
# assertlibly82CVRe.c
# assertlibly82CVRe.c(1) : fatal error C1083: Cannot open include file: 'headerf
ile.h': No such file or directory
#
# STDERR: # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibyRgh8m9y.
c /Feassertlibgd82EAm7.exe /It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
# # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibly82CVRe.c bazbam.lib /
FeassertlibkPth3kRB.exe /link /libpath:H:\DOCUME~1\tony\LOCALS~1\Temp\VS8UWT~1 /
It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
#
t/custom-function....NOK 3# Failed test 'function exists and other function re
turns right value'
# at t/custom-function.t line 84.
# got: 'Can't link/include 'bazbam'
# '
# expected: ''
# STDOUT: assertlibBfnlIMgD.c
# Microsoft (R) Incremental Linker Version 6.00.8447
# Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
#
# /out:assertlibGGAKtWhT.exe
# assertlibBfnlIMgD.obj
# assertlibKUStzxG4.c
# assertlibKUStzxG4.c(1) : fatal error C1083: Cannot open include file: 'headerf
ile.h': No such file or directory
#
# STDERR: # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibBfnlIMgD.
c /FeassertlibGGAKtWhT.exe /It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
# # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibKUStzxG4.c bazbam.lib /
FeassertlibyFusXl32.exe /link /libpath:H:\DOCUME~1\tony\LOCALS~1\Temp\VS8UWT~1 /
It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
#
t/custom-function....NOK 4# Failed test 'function exists'
# at t/custom-function.t line 84.
# got: 'Can't link/include 'bazbam'
# '
# expected: ''
# STDOUT: assertlibHuERVDv4.c
# Microsoft (R) Incremental Linker Version 6.00.8447
# Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
#
# /out:assertlib4aHdLBdE.exe
# assertlibHuERVDv4.obj
# assertlibRgDlBgcx.c
# assertlibRgDlBgcx.c(1) : fatal error C1083: Cannot open include file: 'headerf
ile.h': No such file or directory
#
# STDERR: # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibHuERVDv4.
c /Feassertlib4aHdLBdE.exe /It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
# # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibRgDlBgcx.c bazbam.lib /
FeassertlibXUyopRYs.exe /link /libpath:H:\DOCUME~1\tony\LOCALS~1\Temp\VS8UWT~1 /
It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
#
t/custom-function....NOK 5# Failed test 'function returns right value'
# at t/custom-function.t line 84.
# got: 'Can't link/include 'bazbam'
# '
# expected: ''
# STDOUT: assertlibLkNuoxUt.c
# Microsoft (R) Incremental Linker Version 6.00.8447
# Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
#
# /out:assertlibolrfRrvQ.exe
# assertlibLkNuoxUt.obj
# assertlibUTrDBxns.c
# assertlibUTrDBxns.c(1) : fatal error C1083: Cannot open include file: 'headerf
ile.h': No such file or directory
#
# STDERR: # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibLkNuoxUt.
c /FeassertlibolrfRrvQ.exe /It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
# # E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibUTrDBxns.c bazbam.lib /
FeassertlibOfYPWyTG.exe /link /libpath:H:\DOCUME~1\tony\LOCALS~1\Temp\VS8UWT~1 /
It/inc
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
# Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
#
#
# Looks like you failed 4 tests of 5.
t/custom-function....dubious
Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 2-5
Failed 4/5 tests, 20.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/custom-function.t 4 1024 5 4 80.00% 2-5
Failed 1/1 test scripts, 0.00% okay. 4/5 subtests failed, 20.00% okay.
NMAKE : fatal error U1077: 'H:\Perl\bin\perl.exe' : return code '0x4'
Stop.
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>
With fix:
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>perl -Mblib demo.pl
# E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibaTA2tXXd.c /Feassertlib2z
F7Fzmp.exe /Ic:\tifflib\include
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
assertlibaTA2tXXd.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:assertlib2zF7Fzmp.exe
assertlibaTA2tXXd.obj
# E:\fdrive\PROGRA~1\MICROS~1\VC98\BIN\cl.exe assertlibd8t7Yc1W.c libtiff.lib /F
eassertlibjhAphtFU.exe /Ic:\tifflib\include /link /libpath:c:\tifflib\lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
assertlibd8t7Yc1W.c
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:assertlibjhAphtFU.exe
/libpath:c:\tifflib\lib
assertlibd8t7Yc1W.obj
libtiff.lib
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>nmake test TEST_FILES=t/cust
om-function.t
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
H:\Perl\bin\perl.exe -MExtUtils::Command -e cp bin/use-devel-checklib bl
ib\script\use-devel-checklib
pl2bat.bat blib\script\use-devel-checklib
H:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl
ib\lib', 'blib\arch')" t/custom-function.t
t/custom-function....ok
All tests successful.
Files=1, Tests=5, 2 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU)
C:\home\.cpan\build\Devel-CheckLib-0.699_001-ZEKdvs>
Subject: | checklib.patch |
Index: Devel/CheckLib.pm
===================================================================
--- Devel/CheckLib.pm (revision 1613)
+++ Devel/CheckLib.pm (working copy)
@@ -266,9 +266,9 @@
$cfile,
"${lib}.lib",
"/Fe$exefile",
+ (map { '/I'.Win32::GetShortPathName($_) } @incpaths),
"/link",
(map {'/libpath:'.Win32::GetShortPathName($_)} @libpaths),
- (map { '/I'.Win32::GetShortPathName($_) } @incpaths)
);
} elsif($Config{cc} eq 'CC/DECC') { # VMS
} elsif($Config{cc} =~ /bcc32(\.exe)?/) { # Borland
Subject: | demo.pl |
use Devel::CheckLib;
assert_lib
(
debug => 1,
header => "tiffio.h",
lib => "libtiff",
incpath => "c:\\tifflib\\include",
libpath => "c:\\tifflib\\lib",
function => "char const *p = TIFFGetVersion(); return 0;",
);