How can i static build qt project in Visual Studio
-
@vandal_op said in How can i static build qt project in Visual Studio:
i have a few dll error like the qt6core.dll q6widgets.dll qt6network.dll
You need to adjust your PATH environment variable so the dlls are found during runtime.
-
@vandal_op said in How can i static build qt project in Visual Studio:
how can i do?
where is the dlls?
In your first post you wrote where you installed your Qt to, so I would start searching in there...
-
As you can see in your output you're building for MinGW, not MSVC. Adjust your environment (hint: Visual Studio Command prompt) so cl.exe is properly found by configure.bat/cmake.
-
i watch this video https://youtu.be/KCH92zvrHas?t=330t
and his have a gnuwin32 file in qt src but i dont have
and he is using this file for build.. -
@Christian-Ehrlicher did u have anything info?
-
@vandal_op said in How can i static build qt project in Visual Studio:
did u have anything info?
No - I already told you that you have to make sure that configure picks up the msvc compiler and not the MinGW one as you can't mix the two compiler. So clean up your build dir and start over.
-
@Christian-Ehrlicher finaly i can build now but not working again..
https://prnt.sc/dw5Ji91U6kK6
prefix folder is empty -
doesnt have jom make file
-
Have 3 folders (you can name them however you want):
/src //this is where Qt sources are /build // this is where you build /install //this is where you install
From start menu open x64 Native Tools Command prompt for VS. You don't need admin privileges.
cd
to your build directory (not src!)
In your build directory:
../src/configure -prefix <full path to install dir> -static -static-runtime <any other options you want>
cmake --build . --parallel
cmake --install .
if you also built debug version then alsocmake --install . --config Debug
That's it, 3 or 4 commands. -
@Chris-Kawa
it was running fine but still gave an error -
Read the third line.
-
- cd c:/qt-static/build
- c:/qt-static/src/configure -debug-and-release -commercial -confirm-license -static -platform win32-msvc2019 -nomake examples -nomake tests -prefix C:\Qt-Static\install
- cmake --build . --parallel
build success.
install error
I think I did all the steps correctly but the result is still like this.
-
Don't re-run configure in a directory that you have a failed build in. If a build fails clear the build directory and start over from clean state: empty dir, configure, build, install.
Don't pass-platform win32-msvc2019
. Platform is deduced from the environment i.e. the command prompt bat you used. Note that you're building 32bit version. If you want to build 64bit version start the x64 command prompt.
Don't try to build modules you don't need. In the src dir you have directories like this:qt3d qt5compat qtactiveqt qtcharts ...
Each of them is a Qt module. You need qtbase and qttools. Others are optional. Go through the list and for each module you're not planning to use exclude it via parameter of configure. Some of those are also not supported in a static build (you got a message about it in your previous post). Exclude those too. For example to exclude qtwebengine pass
-skip qtwebengine
. Do that for every module that is not supported or you're not planning to use. -
@Chris-Kawa I need this modules with static
- core;gui;network;widgets
i try build with this code still error in a few minute
- c:/qt-static/src/configure -debug-and-release -commercial -confirm-license -static -nomake examples -nomake tests -prefix C:\Qt-Static\install -skip qtwebengine -skip qt3d -skip qt5compat -skip qtactiveqt -skip qtcharts
-
Please put some effort in. Try to understand what you're doing. Don't just copy/paste stuff.
First - you're running this from a Developer Command Prompt. I said you should be running this from x64 Native Tools Command Prompt (or x86 if you want 32bit build).
Second - these were just the couple modules I listed as an example. There's 38 modules in there. All of
core;gui;network;widgets
are in the qtbase module, so you can skip everything except base and tools.Clean your build dir, reconfigure correctly and build again.