我尝试使用MSYS2提供的静态Qt 6包但没有成功。
相同的代码在 Qt 5.15 动态、Qt 5.15 静态和 Qt 6.5 动态构建中构建得很好,但 Qt 6.5 静态构建因一堆未定义的引用而失败(一些冗余行被省略,因为它超出了帖子限制):
:-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
我记得几个月前 Qt 6.2 也有同样的问题。
这很可能是 Qt 6 特有的东西,可能围绕构建系统的变化。
有什么办法让它发挥作用吗?
更新:这似乎与 Qt 静态链接的默认插件有关。添加
CONFIG -= import_plugins
来清除一些内容后,我得到了一个明显更短的构建命令并减少了未定义的引用计数:
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"
更新2:
我将源代码移到了一个新的 cmake 项目中...这次它构建了,所以显然它与 qmake 相关,对其的支持甚至可能被放弃用于新版本...具有讽刺意味的是,这产生了 80+ MB 的可执行文件(不,它不是调试版本),其中 Qt 5 默认生成约 30 MB 的静态版本...尽管是“静态”,但它甚至不运行 - 显然,运行时库实际上不是静态链接的,所以是的,一项徒劳的大练习。
解决方案:
QMAKE_LIBS += -ltiff -lgraphite2 -lbz2 ...etc...
来自文档:
QMAKE_LIBS
指定每个项目需要链接的其他库。这 该变量的值通常由 qmake 或 qmake.conf 处理并且 很少需要修改。
看起来配置中存在错误,导致这些库实际上未被处理。