Unable to build new Qt Widget application, jom.exe Error 2
-
I'm getting a strange error where some projects will not compile. I have two scenarios below, one which builds fine, while the other does not, and results in a jom.exe Error 2.
Environment:
- Windows 10
- Qt Creator 4.13.3 (fresh install)
- Running Qt 5.15.2 (fresh install)
- Compiling with MSVC 2019 x64 (installed through Qt maintenance tool)
- Visual C++ 2015-2019 Redistributable x64 - 14.28.29334 installed
- Windows 10 SDK (10.0.18362.0) installed
- Build settings (pretty much identical for both scenarios below):
Scenario 1:
- Created new project through File->New Project->Application (Qt)->Qt Console Application->Build system: qmake
- Builds fine, can debug and run
Scenario 2:
- Created new project through File->New Project->Application (Qt)->Qt Widget Application->Build system: qmake
- Will not build, throws jom.exe Error 2:
09:14:04: Running steps for project testWidgets... 09:14:04: Starting: "C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe" C:\Users\jgran\Documents\testWidgets\testWidgets.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" Info: creating stash file C:\Users\jgran\Documents\testWidgets\.qmake.stash 09:14:05: The process "C:\Qt\5.15.2\msvc2019_64\bin\qmake.exe" exited normally. 09:14:05: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" -f C:/Users/jgran/Documents/testWidgets/Makefile qmake_all jom 1.1.3 - empower your cores 09:14:05: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited normally. 09:14:05: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\testWidgets.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I..\..\..\..\Qt\5.15.2\msvc2019_64\include -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtWidgets -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtGui -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtANGLE -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtCore -Idebug -I. -I/include -I..\..\..\..\Qt\5.15.2\msvc2019_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\jgran\AppData\Local\Temp\main.obj.20616.0.jom main.cpp cl -BxC:\Qt\5.15.2\msvc2019_64\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ..\..\..\..\Qt\5.15.2\msvc2019_64\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\testWidgets.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I..\..\..\..\Qt\5.15.2\msvc2019_64\include -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtWidgets -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtGui -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtANGLE -I..\..\..\..\Qt\5.15.2\msvc2019_64\include\QtCore -Idebug -I. -I/include -I..\..\..\..\Qt\5.15.2\msvc2019_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\jgran\AppData\Local\Temp\mainwindow.obj.20616.15.jom mainwindow.cpp jom: C:\Users\jgran\Documents\testWidgets\Makefile.Debug [debug\moc_predefs.h] Error 2 jom: C:\Users\jgran\Documents\testWidgets\Makefile [debug] Error 2 09:14:06: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2. Error while building/deploying project testWidgets (kit: Desktop Qt 5.15.2 MSVC2019 64bit) When executing step "Make" 09:14:06: Elapsed time: 00:02.
I also tried to manually run some commands from Qt 5.15.2 (MSVC 2019 64-bit) (aka Q /K C:\Qt\5.15.2\msvc2019_64\bin\qtenv2.bat) to see if the environment might be setup wrong. After opening the Qt 5.15.2 (MSVC 2019 64-bit) command line and running vcvarsall.bat x64, it's able to find cl.exe and I can run some compiler commands without issue.
I've also read other threads on this error, and most of them seem to point towards an environment setup issue. However, as far as I can tell, the environment should be good.
Does anyone have any other ideas to try and isolate the issue? I would really appreciate any thoughts or a direction to go in.
Edited to show compile error output as code instead of screenshot
-
Ok, this was a huge rabbit hole to go down, and my solution is more of a work around than fixing the original problem.
This is a summary of the timeline and problems I encountered:
- I could build the project from the Qt command line using nmake instead of jom
- Removed Qt 5.15.2 using the Qt maintenance tool
- Installed Qt to 5.15.0 using the Qt maintenance tool, same problem (maybe an issue with jom that is shipped with this Qt creator version?)
- I uninstalled Qt completely to clean the environment and try again
- Using the online Qt installer, I tried to reinstall Qt 5.15.2. At 33% it started throwing:
Hash verification while downloading failed. This is a temporary error, please retry.
- This was not temporary, and would not resolve the hash even after multiple tries/hours. The package it was trying to download was the debugging tools at that point in the installation.
- Other versions of Qt would now not install and throw the error above
- Went to the website and downloaded the offline installer of Qt Creator to see if the jom shipped with this package would work
- After offline installation of Qt, it now wouldn't start the executable - double click the program nothing would happen, tried command line booting it and I could get it to open with only:
qtcreator -noload all -load Core
- Threw more errors. Complained about debugger plugin not being installed properly
- Threw monitor out the window. Regret decision and got a replacement
- Uninstalled Qt completely again
- Installed the full offline installer for Qt 5.12.10, also, apparently this is the last version of Qt that will get an offline installer :(
- Projects now compile and run/debug
So a summary of the environment that I have working is:
- Windows 10
- Qt 5.12.10 using offline installer (Qt Creator 4.13.1)
- Compiling with MSVC 2017 x64 (installed through offline installer)
- Visual C++ 2015-2019 Redistributable x64 - 14.28.29334
- Windows 10 SDK (10.0.18362.0)
I still can't explain what the original issue was with jom throwing Error 2s with no detail, however this seems to be the only remedy for me at the moment.
-
Hi,
Can you show your .pro file ?
Strange thing is that your output does not say exactly what error you got.
-
Thanks for the reply, here's the .pro file:
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
-
Ok, this was a huge rabbit hole to go down, and my solution is more of a work around than fixing the original problem.
This is a summary of the timeline and problems I encountered:
- I could build the project from the Qt command line using nmake instead of jom
- Removed Qt 5.15.2 using the Qt maintenance tool
- Installed Qt to 5.15.0 using the Qt maintenance tool, same problem (maybe an issue with jom that is shipped with this Qt creator version?)
- I uninstalled Qt completely to clean the environment and try again
- Using the online Qt installer, I tried to reinstall Qt 5.15.2. At 33% it started throwing:
Hash verification while downloading failed. This is a temporary error, please retry.
- This was not temporary, and would not resolve the hash even after multiple tries/hours. The package it was trying to download was the debugging tools at that point in the installation.
- Other versions of Qt would now not install and throw the error above
- Went to the website and downloaded the offline installer of Qt Creator to see if the jom shipped with this package would work
- After offline installation of Qt, it now wouldn't start the executable - double click the program nothing would happen, tried command line booting it and I could get it to open with only:
qtcreator -noload all -load Core
- Threw more errors. Complained about debugger plugin not being installed properly
- Threw monitor out the window. Regret decision and got a replacement
- Uninstalled Qt completely again
- Installed the full offline installer for Qt 5.12.10, also, apparently this is the last version of Qt that will get an offline installer :(
- Projects now compile and run/debug
So a summary of the environment that I have working is:
- Windows 10
- Qt 5.12.10 using offline installer (Qt Creator 4.13.1)
- Compiling with MSVC 2017 x64 (installed through offline installer)
- Visual C++ 2015-2019 Redistributable x64 - 14.28.29334
- Windows 10 SDK (10.0.18362.0)
I still can't explain what the original issue was with jom throwing Error 2s with no detail, however this seems to be the only remedy for me at the moment.