expo1967 has asked for the wisdom of the Perl Monks concerning the following question:

my laptop is windows 10 64 bit

I was attempting to upgrade my DBI module using cpan. Things seemed to be running smoothly it suddenly died with a strange error. the last part of the messages from cpan are as follows:

C:\Perl64\bin\perl.exe C:\Perl64\lib\ExtUtils\xsubpp -typemap + C:\Perl64\lib\ExtUtils\typemap -typemap typemap DBI.x s > DBI.xsc && C:\Perl64\bin\perl.exe -MExtUtils::Command -e mv -- DBI +.xsc DBI.c cl -c -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:precise +-DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE - DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DP +ERL_IMPLICIT_SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DVERSION=\"1.642\" -DXS_VERSION=\"1.642\" "-IC:\Perl +64\lib\CORE" DBI.c DBI.c c:\perl64\lib\core\win32.h(218): warning C4005: 'isnan': macro redefin +ition C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corec +rt_math.h(276): note: see previous definition of 'isnan ' DBI.xs(345): warning C4996: 'strcpy': This function or variable may be + unsafe. Consider using strcpy_s instead. To disable de precation, use _CRT_SECURE_NO_WARNINGS. See online help for details. DBI.xs(424): warning C4018: '<': signed/unsigned mismatch DBI.xs(458): warning C4018: '<': signed/unsigned mismatch DBI.xs(484): warning C4018: '<': signed/unsigned mismatch DBI.xs(549): warning C4244: '=': conversion from 'IV' to 'I32', possib +le loss of data DBI.xs(699): warning C4244: '=': conversion from 'IV' to 'STRLEN', pos +sible loss of data DBI.xs(752): warning C4996: 'sprintf': This function or variable may b +e unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(1285): warning C4996: 'strcpy': This function or variable may b +e unsafe. Consider using strcpy_s instead. To disable d eprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. DBI.xs(1307): warning C4244: '=': conversion from 'IV' to 'STRLEN', po +ssible loss of data DBI.xs(1452): warning C4996: 'strcpy': This function or variable may b +e unsafe. Consider using strcpy_s instead. To disable d eprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. DBI.xs(1453): warning C4996: 'strcat': This function or variable may b +e unsafe. Consider using strcat_s instead. To disable d eprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. DBI.xs(1881): warning C4244: 'initializing': conversion from 'IV' to ' +int', possible loss of data DBI.xs(2124): warning C4244: '=': conversion from 'IV' to 'U32', possi +ble loss of data DBI.xs(2257): warning C4244: '=': conversion from 'IV' to 'int', possi +ble loss of data DBI.xs(2248): warning C4244: 'initializing': conversion from 'IV' to ' +int', possible loss of data DBI.xs(2391): warning C4244: '=': conversion from '__int64' to 'int', +possible loss of data DBI.xs(3026): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(3372): warning C4244: '=': conversion from 'IV' to 'int', possi +ble loss of data DBI.xs(3482): warning C4244: '=': conversion from '__int64' to 'I32', +possible loss of data DBI.xs(3698): warning C4018: '<': signed/unsigned mismatch DBI.xs(3441): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(3465): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(3890): warning C4244: 'initializing': conversion from 'IV' to ' +int', possible loss of data DBI.xs(4024): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4379): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4400): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4404): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4422): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4435): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' DBI.xs(4744): warning C4244: '=': conversion from 'IV' to 'U32', possi +ble loss of data DBI.xs(4745): warning C4244: '=': conversion from 'UV' to 'U32', possi +ble loss of data DBI.xs(4827): warning C4244: '=': conversion from 'IV' to 'I32', possi +ble loss of data DBI.xs(4957): warning C4244: 'function': conversion from 'IV' to 'int' +, possible loss of data DBI.xs(4959): warning C4244: 'function': conversion from 'IV' to 'int' +, possible loss of data DBI.xs(5143): warning C4244: '=': conversion from '__int64' to 'I32', +possible loss of data DBI.xs(5221): warning C4244: '=': conversion from '__int64' to 'int', +possible loss of data DBI.xs(5214): warning C4244: 'initializing': conversion from '__int64' + to 'int', possible loss of data DBI.xs(5285): warning C4244: '=': conversion from '__int64' to 'int', +possible loss of data DBI.xs(5343): warning C4244: 'initializing': conversion from '__int64' + to 'const int', possible loss of data DBI.xs(5664): warning C4996: 'sprintf': This function or variable may +be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details +. C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio +.h(1774): note: see declaration of 'sprintf' Running Mkbootstrap for DBI () C:\Perl64\bin\perl.exe -MExtUtils::Command -e chmod -- 644 DBI +.bs C:\Perl64\bin\perl.exe -MExtUtils::Mksymlists -e "Mksymlists( +'NAME'=>\"DBI\", 'DLBASE' => 'DBI', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' => { }, 'DL_VARS' => []);" link -out:blib\arch\auto\DBI\DBI.dll -dll -nologo -nodefaultli +b -debug -opt:ref,icf -ltcg -libpath:"C:\Perl64\lib\CO RE" -machine:AMD64 DBI.obj C:\Perl64\lib\CORE\perl516.lib oldnames. +lib kernel32.lib user32.lib gdi32.lib winspool.lib com dlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.li +b uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib od bc32.lib odbccp32.lib comctl32.lib msvcrt.lib -def:DBI.def DBI.obj : fatal error LNK1112: module machine type 'x86' conflicts wit +h target machine type 'x64' NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual S +tudio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Host X86\x86\link.EXE"' : return code '0x458' Stop. TIMB/DBI-1.642.tar.gz C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Host +X86\x86\nmake.exe -- NOT OK cpan>

I went looking under my C:\Perl64 directory looking for occurrences of "x86" but that did not turn up anything helpfull.
I also installed and tried "cpanm" but that ended up with the same error.

Any ideas ?

Replies are listed 'Best First'.
Re: error upgrading DBI module
by Corion (Patriarch) on Jan 29, 2020 at 21:06 UTC
    fatal error LNK1112: module machine type 'x86' conflicts with target m +achine type 'x64'

    You are building the DBI module (with compiler settings) for 32 bit, but you are linking it with libraries for 64 bit. It seems that your Perl is a 64-bit Perl (because of C:\Perl64). But maybe your C compiler is only 32 bit or set up for 32-bit compilation. I don't know how to change that.

      After a lot of investigating I noticed that I was indeed using the 32 bit env vars instead of the 64 bit env vars. So I now used the 64 bit vars and reran cpan to upgrade the DBI module. Now it fails with the following messages.

      C:\Perl64\bin\perl.exe -p -e "s/~DRIVER~/Perl/g" Driver.xst > +Perl.xsi C:\Perl64\bin\perl.exe C:\Perl64\lib\ExtUtils\xsubpp -typemap + C:\Perl64\lib\ExtUtils\typemap -typemap typemap Perl.xs > Perl.xsc +&& C:\Perl64\bin\perl.exe -MExtUtils::Command -e mv -- Perl.xsc Perl. +c cl -c -nologo -GF -W3 -MD -Zi -DNDEBUG -Ox -GL -fp:precise +-DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE +_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_ +SYS -DUSE_PERLIO -MD -Zi -DNDEBUG -Ox -GL -fp:precise -DVERSION=\" +1.642\" -DXS_VERSION=\"1.642\" "-IC:\Perl64\lib\CORE" Perl.c Perl.c C:\Perl64\lib\CORE\perl.h(621): fatal error C1083: Cannot open include + file: 'stdarg.h': No such file or directory NMAKE : U1077: Stop. TIMB/DBI-1.642.tar.gz C:\bin\nmake.exe -- NOT OK Failed during this command: TIMB/DBI-1.642.tar.gz : make NO cpan>

      I shall keep investigating on this issuer.

        How was Perl installed to begin with? Is it Strawberry, or ActiveState? ...it's been years since I've worked with a Windows installation of Perl, but back then, the Strawberry tooling was better for installing CPAN modules. And ActiveState used PPM distributions.

        Can you do a fresh install of Perl and everything else? Is WSL an option for you?


        Dave

        . So I now used the 64 bit vars and reran cpan to upgrade the DBI module. Now it fails with the following messages.

        Hi, which 64 bit vars exactly? Looks like you forgot a few ;)