Search code examples
c++qtcommand-lineqwt

How to compile 64-bit libraries for qwt-6.1.2 on Windows with command line


We are using Visual Studio 2019, Qt5.12.3 and qwt-6.1.2 (Qwt is a graphics extension to the Qt GUI application framework) on Windows 10. Our solution has traditionally been a 32-bit only application, but we've received a request to deliver it in both 32-bit and 64-bit.

My question is specifically related to 64-bit qwt-6.1.2.

The 32-bit version of qwt-6.1.2 is compiled without problems with the following script that runs in a batch file (no, we cannot use power shell because power shell scripts are disabled on our network).

cd\resources
tar -xf qwt-6.1.2.zip
rem del qwt-6.1.2.zip
cd\resources\qwt-6.1.2

REM Add the x86 path to compile qwt-6.1.2
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;

REM Create qwt make files
REM 1. Set up x86 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
REM 2. Create x86 make files
qmake qwt.pro
REM 3. Compile the binaries for x86 version of qwt-6.1.2
nmake

When trying to compile the same source in 64-bit using the script below I receive hundreds of linker errors

REM Add the x64 path to compile qwt-6.1.2
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin

REM Create qwt make files
REM 1. Set up x64 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
REM 2. Clean up the old qmake data for rebuild to x64
del c:\resources\qwt-6.1.2\.qmake.stash
del c:\resources\qwt-6.1.2\Makefile
REM 3. Create x86 make files
qmake qwt.pro
REM 4. Compile the binaries for x86 version of qwt-6.1.2
nmake
linking ..\lib\qwt.dll
   Creating library ..\lib\qwt.lib and object ..\lib\qwt.exp
qwt_dial.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_knob.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_slider.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_thermo.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_abstract_slider.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_abstract_scale.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_analog_clock.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_compass.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)

etc. etc... ending with

LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
LINK : error LNK2001: unresolved external symbol __load_config_used
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\msvcprt.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\MSVCRT.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64\uuid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
..\lib\qwt.dll : fatal error LNK1120: 47 unresolved externals
NMAKE : fatal error U1077: 'echo' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

It appears that somewhere, something is referencing some 32-bit libraries, but I can't find any documentation (I've been searching for a few days) that specifically deal with compiling a 64-bit version of qwt-6.1.2 (or any of the related qwt versions) on Windows.

Any guidance in finding the 64-bit sources, or instructions on how to compile for 64-bit would be greatly appreciated.


Solution

  • You are missing a call to nmake clean and so there are (even after a fresh qmake) leftovers from the 32bit-build breaking your 64bit-build.