Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.3.2
-
None
-
Windows
Description
Problem Description
Recently, I tried to build a simple QML Application. In order to run without preparing Qt env:
I uncheck the "Add build library search path to path",
and use windeployqt.exe to deploy the QML application. (The following CMake codes are what I used to deploy the QML Apllication)
if(WIN32) # Use '$<TARGET_RUNTIME_DLLS:tgt>' to copy dependent DLL files add_custom_command(TARGET ${target_name} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_RUNTIME_DLLS:${target_name}>" "$<TARGET_FILE_DIR:${target_name}>" COMMAND_EXPAND_LISTS) # Use 'windeployqt' executable to deploy the target add_custom_command(TARGET ${target_name} POST_BUILD COMMAND Qt::windeployqt "$<TARGET_FILE:${target_name}>" --dir "$<TARGET_FILE_DIR:${target_name}>" --qmldir "$<TARGET_FILE_DIR:${target_name}>" --no-translations --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler) endif()
However, The following error showed up after I run the executable in VSCode's terminal:
QML debugging is enabled. Only use this in a safe environment.
QQmlApplicationEngine failed to load component
qrc:/Introduction/main.qml:1:1: Cannot load library C:\Qt\6.3.2\msvc2019_64\qml\QtQml\WorkerScript\workerscriptplugind.dll: 找不到指定的模組。
And another error showed up if I run the executable in the Windows Terminal or QtCreator's console:
QML debugging is enabled. Only use this in a safe environment. QQmlApplicationEngine failed to load component qrc:/Introduction/main.qml:1:1: module "QtQuick" is not installed
And the following screenshot is the output directory after windeployqt.exe:
What happened?
Experiments
After conducting some experiments, I guess that this might be a bug/issue related to windeployqt.exe. Since the error message showed that: module "QtQuick" is not installed, I manually copy the QtQuick from "C:\Qt\6.3.2\msvc2019_64\qml" to my output directory before running windeployqt.exe. And I found that the subsequent deployment is completed magically after I do so. And the QML application works successfully.
Here is the GIF of my experiment: