Issues building on Windows (win32-msvc)
-
I've been having trouble building QT6 on Windows with MSVC.
Here's my setup:- Windows 10 19043.1110
- Visual studio 2019 16.10.4/MSVC 14.29.30037 and 16.11.2/MSVC 14.29.30133 tried
- CMake 3.21.2 and 3.18.6 tried
- Strawberry Perl 5.32.1001
- Python 3.8.150.0
- qtbase repo 6.0.4 and 6.1.3 tried as well as qt-everywhere-src 6.0.4
The same issue has manifested on each version/combination
I get the following error message (or similar) each time I try to build:
[1/1629] Building RC object src\corelib\CMakeFiles\Core_rc.dir\Core_resource.rc.res FAILED: src/corelib/CMakeFiles/Core_rc.dir/Core_resource.rc.res "C:/Program Files/CMake/bin/cmcldeps.exe" RC C:\Users\Yaram\thirdparty\qtbase-6.0.4\src\corelib\Core_resource.rc src\corelib\CMakeFiles\Core_rc.dir\Core_resource.rc.res.d src\corelib\CMakeFiles\Core_rc.dir\Core_resource.rc.res "Note: including file: " "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe -DWIN32 -D_DEBUG /fo src\corelib\CMakeFiles\Core_rc.dir\Core_resource.rc.res C:\Users\Yaram\thirdparty\qtbase-6.0.4\src\corelib\Core_resource.rc 'C:/Program' is not recognized as an internal or external command, operable program or batch file. [10/1629] Building CXX object src\tools\bootstrap\CMakeFiles\Bootstrap.dir\__\__\corelib\text\qstring.cpp.obj ninja: build stopped: subcommand failed.
My build procedure is:
- extract source zip
- open Visual Studio 2019 x64 native tools prompt
cd
to source directory- run
configure
- run
cmake --build .
From the nature of the error message, could be an issue with unescaped quotes in the CMake scripts?
Definitely would appreciate any help on this one! -
Hi and welcome to devnet,
I would install cmake in a path without space.
On a side note, you should use out of source builds. It will avoid polluting the sources with build artifacts to remove if you want to rebuild with a different set of options.
-
Hey, thanks for the reply!
The directory I'm building in has no spaces in it's path, and as far as I'm aware the set install path shouldn't matter prior to running
cmake --install .
? Either way I've tried building withconfigure -prefix C:/qt6
, and had the same issue.I was using an out-of-source-tree build originally, but after running into this issue, I switched to an in-source-tree build as a troubleshooting step to reduce the number of differences between my build steps and the ones described in the documentation here.
-
It's
cmcldeps.exe
that is in a path with spaces. Hence my suggestion to install cmake in a path without spaces.By the way, how did you install it ?
Qt proposes it and it should be installed along the other tools under the Qt folder.
-
Ah, I apologise, I misread your reply.
Installing CMake into a path without a space has changed the error message to
The filename, directory name, or volume label syntax is incorrect.
, the rest of the message is identical, save for the different CMake path. Also confirmed again thatcmcldeps.exe
is still never ran, so I believe this is a manifestation of the same underlying issue.I installed CMake from the official installer.
I think I might build CMake from source and have a look at what's going on internally.
-
-
Did you install CMake with the Qt maintenance tool? I'm betting that you did not due to the CMake directory. I suggest opening the Qt maintenance tool and doing that. it will place it right into your Qt dir and then you can configure your kits to use that CMake instead.
Basically what SGaist has said.
-
That is certainly a good solution for others with this problem, but I'm using Qt as a vendored dependency with
add_subdirectory
and system CMake in a project of mine, so that solution doesn't work for me.I've marked the topic as solved, as there is now a solution for my use case and others.