I am trying to use the static Qt 6 package provided by MSYS2 but to no success.
The same code is building just fine with Qt 5.15 dynamic, Qt 5.15 static and Qt 6.5 dynamic builds, but the Qt 6.5 static build fails with a bunch of undefined references (some redundant lines are omitted because it exceeds the post limit):
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL13myprocesstermP15mng_data_structhhjj+0x9): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL10mysettimerP15mng_data_structj+0x9): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL14mygettickcountP15mng_data_struct+0x6): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL13myclosestreamP15mng_data_struct+0x6): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL15mygetcanvaslineP15mng_data_structj+0x9): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN11QMngHandlerD2Ev+0x22): undefined reference to `__imp_mng_cleanup'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL11mywritedataP15mng_data_structPvjPj+0x12): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL10myreaddataP15mng_data_structPvjPj+0x12): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN11QMngHandlerD0Ev+0x22): undefined reference to `__imp_mng_cleanup'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL15myprocessheaderP15mng_data_structjj+0xe): undefined reference to `__imp_mng_get_userdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZL15myprocessheaderP15mng_data_structjj+0x1e): undefined reference to `__imp_mng_set_canvasstyle'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN11QMngHandler11jumpToImageEi+0x28): undefined reference to `__imp_mng_display_freeze'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN11QMngHandler11jumpToImageEi+0x48): undefined reference to `__imp_mng_display_goframe'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0x56): undefined reference to `__imp_mng_initialize'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0x73): undefined reference to `__imp_mng_setcb_errorproc'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0x84): undefined reference to `__imp_mng_setcb_openstream'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0x95): undefined reference to `__imp_mng_setcb_closestream'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0xa6): undefined reference to `__imp_mng_setcb_readdata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0xb7): undefined reference to `__imp_mng_setcb_writedata'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0xc8): undefined reference to `__imp_mng_setcb_processheader'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0xd9): undefined reference to `__imp_mng_setcb_getcanvasline'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0xea): undefined reference to `__imp_mng_setcb_refresh'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivateC2EP11QMngHandler+0x129): undefined reference to `__imp_mng_set_doprogressive'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate12getNextImageEP6QImage+0x20): undefined reference to `__imp_mng_readdisplay'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate12getNextImageEP6QImage+0x4a): undefined reference to `__imp_mng_display_resume'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate12getNextImageEP6QImage+0xc6): undefined reference to `__imp_mng_display_resume'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0x17): undefined reference to `__imp_mng_reset'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0x21): undefined reference to `__imp_mng_create'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0xe9): undefined reference to `__imp_mng_putchunk_mhdr'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0x111): undefined reference to `__imp_mng_putchunk_term'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0x1c2): undefined reference to `__imp_mng_putchunk_mend'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate10writeImageERK6QImage+0x1d4): undefined reference to `__imp_mng_write'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate11jumpToImageEi+0x27): undefined reference to `__imp_mng_display_freeze'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate11jumpToImageEi+0x48): undefined reference to `__imp_mng_display_goframe'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZN18QMngHandlerPrivate18setBackgroundColorERK6QColor+0x44): undefined reference to `__imp_mng_set_bgcolor'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\imageformats\libqmng.a(qmnghandler.cpp.obj):(.text$_ZNK18QMngHandlerPrivate15backgroundColorEv+0x20): undefined reference to `__imp_mng_get_bgcolor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x53): undefined reference to `jbg_enc_init'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x5b): undefined reference to `jbg_enc_out'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x63): undefined reference to `jbg_enc_free'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0xd3): undefined reference to `jbg_dec_init'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0xe6): undefined reference to `jbg_newlen'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0xff): undefined reference to `jbg_dec_in'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x111): undefined reference to `jbg_dec_getsize'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x128): undefined reference to `jbg_dec_getimage'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x13e): undefined reference to `jbg_dec_free'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x1b3): undefined reference to `jbg_strerror'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_jbig.o):(.text+0x1d9): undefined reference to `jbg_dec_free'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0xf6): undefined reference to `libdeflate_free_decompressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x104): undefined reference to `libdeflate_free_compressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x581): undefined reference to `lerc_encodeForVersion'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x7d5): undefined reference to `libdeflate_zlib_compress_bound'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x802): undefined reference to `libdeflate_zlib_compress'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x866): undefined reference to `libdeflate_alloc_compressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x8a3): undefined reference to `ZSTD_compress'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x8ae): undefined reference to `ZSTD_isError'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lerc.o):(.text+0x924): undefined reference to `ZSTD_getErrorName'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../..
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x476): undefined reference to `lzma_stream_encoder'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x52e): undefined reference to `lzma_code'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x544): undefined reference to `lzma_memusage'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x552): undefined reference to `lzma_stream_decoder'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x6ef): undefined reference to `lzma_stream_decoder'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x7a8): undefined reference to `lzma_end'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x808): undefined reference to `lzma_end'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0x8a0): undefined reference to `lzma_end'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_lzma.o):(.text+0xa88): undefined reference to `lzma_lzma_preset'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0xc5): undefined reference to `libdeflate_free_decompressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0xd6): undefined reference to `libdeflate_free_compressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0x2d7): undefined reference to `libdeflate_zlib_compress_bound'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0x313): undefined reference to `libdeflate_zlib_compress'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0x3a3): undefined reference to `libdeflate_alloc_compressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0x832): undefined reference to `libdeflate_zlib_decompress'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0x948): undefined reference to `libdeflate_alloc_decompressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zip.o):(.text+0xb9b): undefined reference to `libdeflate_free_compressor'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x93): undefined reference to `ZSTD_freeDStream'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0xaf): undefined reference to `ZSTD_freeCStream'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x17a): undefined reference to `ZSTD_compressStream'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x185): undefined reference to `ZSTD_isError'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x204): undefined reference to `ZSTD_getErrorName'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x290): undefined reference to `ZSTD_endStream'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libtiff.a(tif_zstd.o):(.text+0x29b): undefined reference to `ZSTD_isError'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libwebp.a(picture_csp_enc.c.obj):(.text+0x845): undefined reference to `SharpYuvInit'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libwebp.a(picture_csp_enc.c.obj):(.text+0x84c): undefined reference to `SharpYuvGetConversionMatrix'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libwebp.a(picture_csp_enc.c.obj):(.text+0x8d3): undefined reference to `SharpYuvConvert'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x82): undefined reference to `__imp_VariantInit'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x98): undefined reference to `__imp_VariantClear'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x1d9): undefined reference to `__imp_VariantClear'
:-1: error: C:\msys64\ucrt64\qt6-static\share\qt6\plugins\networkinformation\libqnetworklistmanager.a(qnetworklistmanagerevents.cpp.obj):(.text$_ZN25QNetworkListManagerEvents24checkBehindCaptivePortalEv+0x24d): undefined reference to `__imp_VariantClear'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x14c): undefined reference to `gr_make_face_with_ops'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x1e6): undefined reference to `gr_face_destroy'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x32f): undefined reference to `gr_face_featureval_for_lang'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x356): undefined reference to `gr_face_find_fref'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x36a): undefined reference to `gr_fref_set_feature_value'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x444): undefined reference to `gr_make_seg'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x45c): undefined reference to `gr_seg_n_slots'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x585): undefined reference to `gr_seg_first_slot'
:-1: error: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libfreetype.a(src_bzip2_ftbzip2.c.obj):(.text+0x612): undefined reference to `BZ2_bzDecompressInit'
:-1: error: collect2.exe: error: ld returned 1 exit status
:-1: error: [Makefile.Release:98: release/um.exe] Error 1
I recall that was the same issue with Qt 6.2 several months ago.
So likely it is something Qt 6 specific, probably around the build system changes.
Any way to get it working?
Update: It appears to have to do with the default plugins which Qt is statically linking. After adding CONFIG -= import_plugins
to clear things a bit, I get a significantly shorter build command and reduced undefined refs count:
g++ -Wl,-s -static -static -Wl,-subsystem,windows -mthreads -o release\um.exe release/main.o release/qrc_qml.o release/qrc_media.o release/moc_client.o release/moc_platform.o -latomic C:\msys64\ucrt64\qt6-static\share\qt6\qml\QtQuick\objects-Release\Quick_resources_1\.rcc\qrc_qmake_QtQuick.cpp.obj C:\msys64\ucrt64\qt6-static\lib\objects-Release\Quick_resources_2\.rcc\qrc_scenegraph_shaders.cpp.obj C:\msys64\ucrt64\qt6-static\lib\libQt6Quick.a C:\msys64\ucrt64\qt6-static\lib\libQt6OpenGL.a C:\msys64\ucrt64\qt6-static\lib\objects-Release\Gui_resources_1\.rcc\qrc_qpdf.cpp.obj C:\msys64\ucrt64\qt6-static\lib\objects-Release\Gui_resources_2\.rcc\qrc_gui_shaders.cpp.obj C:\msys64\ucrt64\qt6-static\lib\libQt6Gui.a -ld3d11 -ldxgi -ldxguid -ldcomp -lpng -lglib-2.0 -lusp10 -lshlwapi -lintl -lm -lgraphite2 -lrpcrt4 -lbz2 -lharfbuzz -lfreetype -ld2d1 -ldwrite C:\msys64\ucrt64\qt6-static\share\qt6\qml\QtQml\Models\objects-Release\QmlModels_resources_1\.rcc\qrc_qmake_QtQml_Models.cpp.obj C:\msys64\ucrt64\qt6-static\lib\libQt6QmlModels.a C:\msys64\ucrt64\qt6-static\share\qt6\qml\QtQml\Base\objects-Release\Qml_resources_1\.rcc\qrc_qmake_QtQml_Base.cpp.obj C:\msys64\ucrt64\qt6-static\lib\objects-Release\Qml_resources_2\.rcc\qrc_qmlMetaQmldir.cpp.obj C:\msys64\ucrt64\qt6-static\lib\libQt6Qml.a C:\msys64\ucrt64\qt6-static\lib\libQt6Network.a -lbrotlidec -lbrotlicommon -ldnsapi -liphlpapi -lsecur32 -lwinhttp C:\msys64\ucrt64\qt6-static\lib\libQt6Core.a -lz -lsynchronization -lmpr -luserenv -ladvapi32 -lauthz -lkernel32 -lnetapi32 -lole32 -lshell32 -luser32 -luuid -lversion -lwinmm -lb2 -lpcre2-16 -lssl -lcrypto -lws2_32 -lgdi32 -lcrypt32 -lmingw32 C:\msys64\ucrt64\qt6-static\lib\libQt6EntryPoint.a -lshell32
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x14c): undefined reference to `gr_make_face_with_ops'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x1e6): undefined reference to `gr_face_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x80c): undefined reference to `gr_seg_first_slot'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x83a): undefined reference to `gr_slot_advance_Y'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x854): undefined reference to `gr_slot_next_in_segment'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x868): undefined reference to `gr_slot_origin_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x88b): undefined reference to `gr_slot_origin_Y'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x8d1): undefined reference to `gr_seg_advance_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x915): undefined reference to `gr_slot_origin_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x94f): undefined reference to `gr_featureval_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x959): undefined reference to `gr_seg_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0x9eb): undefined reference to `gr_seg_advance_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xa02): undefined reference to `gr_seg_first_slot'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xa3a): undefined reference to `gr_slot_advance_Y'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xa54): undefined reference to `gr_slot_origin_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xa91): undefined reference to `gr_slot_origin_Y'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xab4): undefined reference to `gr_slot_next_in_segment'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb1e): undefined reference to `gr_featureval_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb3e): undefined reference to `gr_featureval_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb48): undefined reference to `gr_seg_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb61): undefined reference to `gr_seg_first_slot'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb69): undefined reference to `gr_slot_origin_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xb80): undefined reference to `gr_seg_advance_X'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xbb9): undefined reference to `gr_featureval_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-graphite2.cc.obj):(.text+0xbc3): undefined reference to `gr_seg_destroy'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../lib\libharfbuzz.a(hb-uniscribe.cc.obj):(.text+0x6d9): undefined reference to `__imp_UuidCreate'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [Makefile.Release:82: release/um.exe] Error 1
mingw32-make[1]: Leaving directory 'F:/prg/build-um-6_2_Static-Release'
mingw32-make: *** [Makefile:45: release] Error 2
16:13:58: The process "C:\msys64\ucrt64\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project um (kit: 6.2 Static)
When executing step "Make"
Update 2:
I moved the sources into a new cmake project... and this time it builds, so evidently it is qmake related, support for which maybe even abandoned for new releases... Ironically, this produced a frigging 80+ MB of executable (no, it is not a debug builds), where Qt 5 produced static builds around 30 MB by default... and it doesn't even run despite being "static" - evidently, runtime libs are actually not linked statically, so yeah, one big exercise in futility.
The solution:
QMAKE_LIBS += -ltiff -lgraphite2 -lbz2 ...etc...
From the documentation:
QMAKE_LIBS
Specifies additional libraries each project needs to link against. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.
Looks like a bug in the configuration leading to those libs actually not being handled.