Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
Qt Creator 4.11.1
-
None
-
Windows 10
Desktop Qt 5.14.1 MinGW 32-bit
MinGW 7.3.0
Description
Not a bug in Qt Creator, but this issue is to propose a workaround for windres.
If you select "Clear system environment" in the project build settings, by default it only has PATH and QTDIR defined.
If you then add any qmake options that trigger an RC build, like "RC_ICONS", windres fails with a very strange popen error.
Build log:
windres -i stuff_resource.rc -o stuff_resource_res.o --include-dir=. -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DAPP_VERSION=0.1.0.0 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB
...windres: can't popen `gcc -E -xc -DRC_INVOKED -I. -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DAPP_VERSION=0.1.0.0 -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_CORE_LIB stuff_resource.rc': No error
mingw32-make: *** [Makefile:101: stuff_resource_res.o] Error 1
The fix is somewhat easy, although finding it took forever. When using a clean sys env for building the project the COMSPEC variable is undefined. I have a feeling the frankly terrible way that windres operates has some bugs that crop up when this is missing, adding it fixes the error entirely:
I propose that Qt Creator adds this option by default for windows builds that use mingw.