개요
프로젝트의 빌드가 제대로 되었어도, qt로 만든 .exe 프로그램이 실행이 안되는 경우가 존재한다.
에러 메시지
“Qt6Wdigetsd.dll가 없어 코드 실행을 진행할 수 없습니다. 프로그램을 다시 설치하면 이 문제가 해결될 수 있습니다.” 이런 에러가 발생
해결 방법
QT응용 프로그램을 배포하려면 그냥 windeployqt를 사용하는 것이 권장되는 것 같다. 빌드 시 생성한 실행파일을 단독으로 실행할 수 있도록 필요한 라이브러리를 exe 파일이 있는 경로에 자동으로 추가해주는 툴이다. Release던 Debug던 이런 현상은 생기는 것 같다.
- 실행파일에서 필요한 QT 모듈 자동 분석
- .dll, .plugins, .qml 등 모든 종속 리소스 복사
공식 문서에 따르면 `QTDIR/bin/windeployqt`에서 windeployqt를 찾을 수 있다고 한다.
windeployqt의 실행 화면
Usage: C:\Qt\6.8.3\msvc2022_64\bin\windeployqt.exe [options] [files]
Qt Deploy Tool 6.8.3
The simplest way to use windeployqt is to add the bin directory of your Qt
installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:
windeployqt <path-to-app-binary>
If your application uses Qt Quick, run:
windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>
Options:
-?, -h, --help Displays help on commandline
options.
--help-all Displays help, including generic Qt
options.
-v, --version Displays version information.
--dir <directory> Use directory instead of binary
directory.
--qmake <path> Use specified qmake instead of
qmake from PATH. Deprecated, use
qtpaths instead.
--qtpaths <path> Use specified qtpaths.exe instead
of qtpaths.exe from PATH.
--libdir <path> Copy libraries to path.
--plugindir <path> Copy plugins to path.
--translationdir <path> Copy translations to path.
--qml-deploy-dir <path> Copy qml files to path.
--debug Assume debug binaries.
--release Assume release binaries.
--pdb Deploy .pdb files (MSVC).
--force Force updating files.
--dry-run Simulation mode. Behave normally,
but do not copy/update any files.
--no-patchqt Do not patch the Qt6Core library.
--ignore-library-errors Ignore errors when libraries cannot
be found.
--no-plugins Skip plugin deployment.
--include-soft-plugins Include in the deployment all
relevant plugins by taking into
account all soft dependencies.
--skip-plugin-types <plugin types> A comma-separated list of plugin
types that are not deployed
(qmltooling,generic).
--add-plugin-types <plugin types> A comma-separated list of plugin
types that will be added to
deployment
(imageformats,iconengines)
--include-plugins <plugins> A comma-separated list of
individual plugins that will be
added to deployment (scene2d,qjpeg)
--exclude-plugins <plugins> A comma-separated list of
individual plugins that will not be
deployed (qsvg,qpdf)
--no-libraries Skip library deployment.
--qmldir <directory> Scan for QML-imports starting from
directory.
--qmlimport <directory> Add the given path to the QML
module search locations.
--no-quick-import Skip deployment of Qt Quick
imports.
--translations <languages> A comma-separated list of languages
to deploy (de,fi).
--no-translations Skip deployment of translations.
--no-system-d3d-compiler Skip deployment of the system D3D
compiler.
--no-system-dxc-compiler Skip deployment of the system DXC
(dxcompiler.dll, dxil.dll).
--compiler-runtime Deploy compiler runtime (Desktop
only).
--no-compiler-runtime Do not deploy compiler runtime
(Desktop only).
--json Print to stdout in JSON format.
--no-opengl-sw Do not deploy the software
rasterizer library.
--no-ffmpeg Do not deploy the FFmpeg libraries.
--force-openssl Deploy openssl plugin but ignore
openssl library dependency
--openssl-root <directory> Directory containing openSSL
libraries.
--list <option> Print only the names of the files
copied.
Available options:
source: absolute path of the
source files
target: absolute path of the
target files
relative: paths of the target
files, relative
to the target directory
mapping: outputs the source and
the relative
target, suitable for use
within an
Appx mapping file
--verbose <level> Verbose level (0-2).
Qt libraries can be added by passing their name (-xml) or removed by passing
the name prepended by --no- (--no-xml). Available libraries:
charts chartsqml concurrent core dbus designer designercomponentsInternal
devicediscoverysupportInternal entrypointInternal exampleiconsInternal
examplesassetdownloaderInternal fbsupportInternal ffmpegmediapluginimplInternal
freetypeInternal gui harfbuzzInternal qthelp jpegInternal labsanimation
labsfolderlistmodel labsplatform labsqmlmodels labssettings labssharedimage
labswavefrontmesh linguist multimedia multimediaquickInternal
multimediatestlibInternal multimediawidgets network opengl openglwidgets
packetprotocolInternal pngInternal printsupport qdoccatchconversionsInternal
qdoccatchgeneratorsInternal qdoccatchInternal qml qmlassetdownloader qmlcompiler
qmlcore qmldebugInternal qmldomInternal qmlintegration qmllocalstorage
qmllsInternal qmlmeta qmlmodels qmlnetwork qmltoolingsettingsInternal
qmltyperegistrarInternal qmlworkerscript qmlxmllistmodel quick quick3d
quick3dassetimport quick3dassetutils quick3deffects quick3dglslparserInternal
quick3dhelpers quick3dhelpersimpl quick3diblbaker quick3dparticleeffects
quick3dparticles quick3druntimerender quick3dspatialaudioInternal quick3dutils
quick3dxr quickcontrols2 quickcontrols2basic quickcontrols2basicstyleimpl
quickcontrols2fluentwinui3styleimpl quickcontrols2fusion
quickcontrols2fusionstyleimpl quickcontrols2imagine
quickcontrols2imaginestyleimpl quickcontrols2impl quickcontrols2material
quickcontrols2materialstyleimpl quickcontrols2universal
quickcontrols2universalstyleimpl quickcontrols2windowsstyleimpl
quickcontrolstestutilsInternal quickdialogs2 quickdialogs2quickimpl
quickdialogs2utils quickeffectsInternal quicklayouts quickparticlesInternal
quickshapesInternal quicktemplates2 quicktest quicktestutilsInternal
quicktimeline quicktimelineblendtrees quickvectorimage
quickvectorimagegeneratorInternal quickwidgets shadertools spatialaudio sql svg
svgwidgets test testinternalsInternal toolsInternal uiplugin uitools widgets xml
zlibInternal
Qt plugins can be included or excluded individually or by type.
To deploy or block plugins individually, use the --include-plugins
and --exclude-plugins options (--include-plugins qjpeg,qsvgicon)
You can also use the --skip-plugin-types or --add-plugin-types to
achieve similar results with entire plugin groups, like imageformats, e.g.
(--add-plugin-types imageformats,iconengines). Exclusion always takes
precedence over inclusion, and types take precedence over specific plugins.
For example, including qjpeg, but skipping imageformats, will NOT deploy qjpeg.
Detected available plugins:
iconengines:
qsvgicon
assetimporters:
assimp
designer:
qaxwidget
qquickwidget
generic:
qtuiotouchplugin
networkinformation:
qnetworklistmanager
imageformats:
qgif
qico
qjpeg
qsvg
help:
helpplugin
multimedia:
ffmpegmediaplugin
windowsmediaplugin
platforms:
qdirect2d
qminimal
qoffscreen
qwindows
qmllint:
quicklintplugin
qmlls:
qmllsquickplugin
qmltooling:
qmldbg_debugger
qmldbg_inspector
qmldbg_local
qmldbg_messages
qmldbg_native
qmldbg_nativedebugger
qmldbg_preview
qmldbg_profiler
qmldbg_quick3dprofiler
qmldbg_quickprofiler
qmldbg_server
qmldbg_tcp
sqldrivers:
qsqlite
qsqlmimer
qsqlodbc
qsqlpsql
styles:
qmodernwindowsstyle
tls:
qcertonlybackend
qopensslbackend
qschannelbackend
Arguments:
[files] Binaries or directory containing
the binary.
위 설명을 읽어보니, 간단하기 사용하려면 windeployqt.exe에 내가 빌드한 프로그램의 exe파일이 있는 경로를 적어주면 되는 것 같았다.
C:\Qt\6.8.3\msvc2022_64\bin\windeployqt.exe .\build\Debug\Lidar-Visualization.exe
이후 다음과 같은 로그들이 발생하며, 성공적으로 됨을 확인할 수 있었다.
D:\Development\Projects\lidar-visualization\build\Debug\Lidar-Visualization.exe 64 bit, debug executable
Adding in plugin type generic for module: Qt6Gui
Adding Qt6Network for qtuiotouchplugind.dll from plugin type: generic
Adding in plugin type iconengines for module: Qt6Gui
Adding Qt6Svg for qsvgicond.dll from plugin type: iconengines
Adding in plugin type imageformats for module: Qt6Gui
Adding in plugin type networkinformation for module: Qt6Network
Adding in plugin type platforms for module: Qt6Gui
Adding in plugin type styles for module: Qt6Widgets
Adding in plugin type tls for module: Qt6Network
Skipping plugin qopensslbackendd.dll. Use -force-openssl or specify -openssl-root if you want to use it.
Direct dependencies: Qt6Core Qt6Gui Qt6Widgets
All dependencies : Qt6Core Qt6Gui Qt6Widgets
To be deployed : Qt6Core Qt6Gui Qt6Network Qt6Svg Qt6Widgets
Warning: Cannot find any version of the dxcompiler.dll and dxil.dll.
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Updating Qt6Cored.dll.
Updating Qt6Guid.dll.
Updating Qt6Networkd.dll.
Updating Qt6Svgd.dll.
Updating Qt6Widgetsd.dll.
Updating opengl32sw.dll.
Updating D3Dcompiler_47.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/generic.
Updating qtuiotouchplugind.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/iconengines.
Updating qsvgicond.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/imageformats.
Updating qgifd.dll.
Updating qicod.dll.
Updating qjpegd.dll.
Updating qsvgd.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/networkinformation.
Updating qnetworklistmanagerd.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/platforms.
Updating qwindowsd.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/styles.
Updating qmodernwindowsstyled.dll.
Creating directory D:/Development/Projects/lidar-visualization/build/Debug/tls.
Updating qcertonlybackendd.dll.
Updating qschannelbackendd.dll.
Creating D:\Development\Projects\lidar-visualization\build\Debug\translations...
Creating qt_ar.qm...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fa.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hr.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ka.qm...
Creating qt_ko.qm...
Creating qt_lg.qm...
Creating qt_lv.qm...
Creating qt_nl.qm...
Creating qt_nn.qm...
Creating qt_pl.qm...
Creating qt_pt_BR.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_tr.qm...
Creating qt_uk.qm...
Creating qt_zh_CN.qm...
Creating qt_zh_TW.qm...
참고 자료
https://doc.qt.io/qt-6/windows-deployment.html
https://1d1cblog.tistory.com/107
'QT' 카테고리의 다른 글
| [Qt] CMakePresets.json, CMakeUserPresets.json (0) | 2025.08.20 |
|---|---|
| [QT] QOpenGLShaderProgram의 addShaderFromSourceCode 메서드 (0) | 2025.05.18 |
| [QT] QApplication (0) | 2025.05.02 |
| [QT] CMake로 환경 설정 (0) | 2025.04.30 |