msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.28k stars 1.22k forks source link

Executable not static linked with qt6-static #15824

Open missdeer opened 1 year ago

missdeer commented 1 year ago

Description / Steps to reproduce the issue

  1. write a simple program with Qt
  2. build with qt6-static

Expected behavior

Executable is static linked.

Actual behavior

Many DLL files are linked dynamically, such as: libgcc_s_seh-1.dll libwinpthread-1.dll libb2-1.dll libfreetype-6.dll libbz2-1.dll libbrotlidec.dll libbrotlicommon.dll libharfbuzz-0.dll libstdc++-6.dll libglib-2.0-0.dll libintl-8.dll libiconv-2.dll libpcre2-8-0.dll libgraphite2.dll libpng16-16.dll zlib1.dll libjpeg-8.dll libmng-2.dll liblcms2-2.dll libpcre2-16-0.dll libtiff-6.dll libdeflate.dll libjbig-0.dll libLerc.dll liblzma-5.dll libwebp-7.dll libsharpyuv-0.dll libzstd.dll libwebpdemux-2.dll libwebpmux-3.dll

Verification

Windows Version

MSYS_NT-10.0-19044

MINGW environments affected

Are you willing to submit a PR?

No response

H5117 commented 5 days ago

Not sure this is the same issue, but qt6-static in mingw64 is still broken (after pacman -Syu). With qt5-static the same program works fine.

linking ``` $ /d/msys64/mingw64/qt6-static/bin/qmake.exe /d/Project/Project.pro Info: creating stash file D:\Project-build\.qmake.stash $ mingw32-make.exe -j2 D:/msys64/mingw64/bin/mingw32-make.exe -f Makefile.Release <...compiling...> g++ -Wl,-s -static -static -Wl,-subsystem,windows -mthreads -o release/Project.exe release/main.o release/mainwindow.o release/scanner.o release/project_plugin_import.o release/moc_m ainwindow.o release/moc_scanner.o D:/msys64/mingw64/qt6-static/share/qt6/plugins/styles/libqmodernwindowsstyle.a D:/msys64/mingw64/qt6-static/lib/objects-Release/QWindowsIntegrationPlugin_resources_1/.rcc/qrc_openglblacklists _init.cpp.obj D:/msys64/mingw64/qt6-static/lib/objects-Release/QWindowsIntegrationPlugin_resources_2/.rcc/qrc_cursors_init.cpp.obj D:/msys64/mingw64/qt6-static/share/qt6/plugins/platforms/libqwindows.a -limm32 -loleaut32 -lwi nspool -lwtsapi32 -lshcore -lcomdlg32 -ld3d9 -lruntimeobject D:/msys64/mingw64/qt6-static/lib/libQt6OpenGL.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/iconengines/libqsvgicon.a D:/msys64/mingw64/qt6-static/share/qt6/plug ins/imageformats/libqgif.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqicns.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqico.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageforma ts/libqjpeg.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqmng.a -lmng -llcms2 D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqsvg.a D:/msys64/mingw64/qt6-static/lib/libQt6Svg.a D:/msys64/mi ngw64/qt6-static/share/qt6/plugins/imageformats/libqtga.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqtiff.a -ltiff -lzstd -llzma -lLerc -ljbig -ljpeg -ldeflate D:/msys64/mingw64/qt6-static/share/qt6/plugi ns/imageformats/libqwbmp.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/imageformats/libqwebp.a -lwebp -lwebpdemux -lwebpmux -lsharpyuv D:/msys64/mingw64/qt6-static/share/qt6/plugins/networkinformation/libqnetworklistmanage r.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/tls/libqopensslbackend.a D:/msys64/mingw64/qt6-static/share/qt6/plugins/tls/libqschannelbackend.a -lbcrypt -lncrypt D:/msys64/mingw64/qt6-static/lib/objects-Release/Widgets_r esources_1/.rcc/qrc_qstyle_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/objects-Release/Widgets_resources_2/.rcc/qrc_qstyle1_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/objects-Release/Widgets_resources_3/.rcc/qrc_qstyle_f usion_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/objects-Release/Widgets_resources_4/.rcc/qrc_qmessagebox_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/libQt6Widgets.a -ldwmapi D:/msys64/mingw64/qt6-static/lib/objects-Rele ase/Gui_resources_1/.rcc/qrc_qpdf_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/objects-Release/Gui_resources_2/.rcc/qrc_gui_shaders_init.cpp.obj D:/msys64/mingw64/qt6-static/lib/libQt6Gui.a -ld3d11 -ldxgi -ldxguid -ld3d12 -l uxtheme -lpng -lpng16 -lpcre2-8 -lglib-2.0 -lusp10 -lshlwapi -lintl -lm -lgraphite2 -lrpcrt4 -lbz2 -lharfbuzz -lfreetype -ld2d1 -ldwrite D:/msys64/mingw64/qt6-static/lib/libQt6SerialPort.a -lsetupapi D:/msys64/mingw64/qt6-sta tic/lib/libQt6Network.a -lbrotlidec -lbrotlicommon -ldnsapi -liphlpapi -lsecur32 -lwinhttp -lssl -lcrypto -lgdi32 -lcrypt32 D:/msys64/mingw64/qt6-static/lib/libQt6Core.a -lz -lsynchronization -lmpr -luserenv -ladvapi32 -lauth z -lkernel32 -lnetapi32 -lole32 -lshell32 -luser32 -luuid -lversion -lwinmm -lws2_32 -lb2 -lpcre2-16 -lmingw32 D:/msys64/mingw64/qt6-static/lib/libQt6EntryPoint.a -lshell32 D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmng: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llcms2: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ltiff: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lLerc: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljbig: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljpeg: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldeflate: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwebp: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwebpdemux: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwebpmux: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsharpyuv: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpng: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpng16: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpcre2-8: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglib-2.0: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgraphite2: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lharfbuzz: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lfreetype: No such file or directory D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpcre2-16: No such file or directory collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [Makefile.Release:86: release/Project.exe] Error 1 mingw32-make[1]: Leaving directory 'D:/Project-build' mingw32-make: *** [Makefile:45: release] Error 2 ```