Search code examples
c++windowsqtmakefileqmake

Qt5Quickd.lib(Qt5Quickd.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'


I'm trying to build Qt application with command line rather than QtCreator GUI tools. I'm using Developer Command Prompt for VS 2017 by running these commands:

"C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\bin\qmake.exe" ..\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
"C:\Qt\Qt5.13.0\Tools\QtCreator\bin\jom.exe" -f ../../build-qt3dsceneeditor-Desktop_Qt_5_13_0_MSVC2017_64bit-Debug/Makefile qmake_all
"C:\Qt\Qt5.13.0\Tools\QtCreator\bin\jom.exe"

The build process is all fine until the link stage which runs into this error:

link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /DLL /SUBSYSTEM:WINDOWS /MANIFEST:embed /OUT:debug\editorlib.dll @C:\Users\me\AppData\Local\Temp\editorlib.dll.13948.102703.jom
Qt5Quickd.lib(Qt5Quickd.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
jom: C:\Users\me\repos\qt3d-editor\scripts\editorlib\Makefile.Debug [debug\editorlib.dll] Error 1112
jom: C:\Users\me\repos\qt3d-editor\scripts\editorlib\Makefile [debug] Error 2
jom: C:\Users\me\repos\qt3d-editor\scripts\Makefile [sub-editorlib-make_first-ordered] Error 2

I have studied the similar errors reported by others, mentioning that I need to change Visual Studio configuration. But In my case, I'm not using VS GUI. How can I change configuration on Developer Command Prompt for VS 2017?

Also I appreciate if somebody can introduce a good guide for building Qt applications with command-line tools rather than QtCreator GUI!

As suggested by @code_fodder, I'm looking at QtCreator logs. QtCreator does compiling/linking without any error:

QtCreator is fine

The error on command-line is:

Command line runs into error

I also tried using nmake rather than jom which runs into the same error:

echo Setting up environment for Qt usage...
set PATH=C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\bin;%PATH%
echo --------------------------------------
mkdir C:\Users\me\repos\build
cd C:\Users\me\repos\build\
qmake.exe -makefile C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro
nmake /u /f Makefile

UPDATE

On Linux, I don't run into such error. On openSUSE Leap 15.1, this script works just fine:

#!/bin/sh 

export PATH=~/Qt5.13.0/5.13.0/gcc_64/bin/:$PATH 
mkdir build 
cd build 
qmake ../qt3dsceneeditor.pro -spec linux-icc-64 CONFIG+=qtquickcompiler 
make -j4

Solution

  • Problem got resolved by this script:

    set PATH=C:\Qt\Qt5.13.0\5.13.0\msvc2017_64\bin;%PATH%
    set PATH=C:\Qt\Qt5.13.0\Tools\QtCreator\bin;%PATH%
    mkdir C:\Users\me\repos\qt3d-editor\scripts\build-deploy\temp
    cd C:\Users\me\repos\qt3d-editor\scripts\build-deploy\temp
    qmake.exe C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
    jom.exe qmake_all
    jom.exe
    

    I'm not sure which modification resolved the problem.


    Also in debug mode the build is fine:

    qmake.exe C:\Users\me\repos\qt3d-editor\qt3dsceneeditor.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug"
    

    I run the scripts on x64 Native Tools Command Prompt for VS 2017:

    x64 Native Tools Command Prompt for VS 2017