Error on Qt 6 Building from source for Windows Based
-
Hi,
IIRC, cmake 3.19.2 or newer is recommended but I don't have the source at hand.
-
You should update your cmake version.
-
Did you restart from a clean state ?
-
What did you do to ensure a clean state ?
-
Use 5.15 and you're fine. Don't know why everyone needs to use Qt6 when it's documented that it's not feature complete... Qt6 does not have any advantage for an average user at the current state.
-
This is the
do_it.bat
I'm using to build Qt6. Adjust the paths and configure options at the top to whatever you like. You only need to have CMake in PATH, nothing else, or you can just spell out its path right in the bat script.SET VS_ENVIRONMENT="C:\Program Files (x86)\Microsoft Visual Studio 2019\VC\Auxiliary\Build\vcvars64.bat" SET SRC_DIR="C:\Qt\6.0.1\Src" SET BUILD_DIR="C:\Qt\6.0.1\Build" SET INSTALL_DIR="C:\Qt\6.0.1\msvc2019_64" SET CONFIGURE_OPTIONS=-debug-and-release -mp -opensource -confirm-license call %VS_ENVIRONMENT% mkdir %BUILD_DIR% mkdir %INSTALL_DIR% cd %BUILD_DIR% call %SRC_DIR%\configure -prefix %INSTALL_DIR% %CONFIGURE_OPTIONS% cmake --build . --parallel cmake --install . cmake --install . --config Debug cd %INSTALL_DIR% rmdir %BUILD_DIR% /Q /S pause
This builds Qt out of source (the only sane way to do it cleanly), copies result to the install directory and removes the temporary build directory (which can get huuuge if you're building everything).
Some notes on the discussion points above:
- Depending on your version of VS (Pro, Cmmunity etc.) the VS install dir will look a bit different. If in doubt just find "x64 Native Tools Command Prompt for VS 2019" shortcut in your start menu and see where it points to
- There are couple of different .bats to set VS environment. For x64 build use either
vcvarsall.bat amd64
or a shortcutvcvars64.bat
- Keep source and build directories next to each other e.g.
<some path>\src
and<some path>\build
. Theoretically it should be possible to build out of source to anywhere, but I've had multiple problems with mismatched number of..
and the likes in the past so keep it this way just to make it easier for yourself. - It's a good idea to exclude whichever modules you don't need in configure options e.g.
-skip qtdatavis3d
. I usually use only about 3-5 modules and exclude everything else, which cuts down compilation time and output size immensely.
-
@Christian-Ehrlicher you are right !