weixin_39835158
weixin_39835158
2021-01-08 11:17

Qt mingw 编译debug 找不到库

fyb-VQ8Q5PD MINGW64 /e/temp/test $ xmake f -p mingw --mingw=C:/Qt/Qt5.13.2/Tools/mingw730_64 -m debug --qt=C:/Qt/Qt5.13.2/5.13.2

fyb-VQ8Q5PD MINGW64 /e/temp/test $ xmake build [ 75%]: linking.debug test.exe error: C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libQt5Cored.a when searching for -lQt5Cored C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib\libQt5Cored.a when searching for -lQt5Cored C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libQt5Cored.a when searching for -lQt5Cored C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtfreetyped.a when searching for -lqtfreetyped C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib\libqtfreetyped.a when searching for -lqtfreetyped C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtfreetyped.a when searching for -lqtfreetyped C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtfreetyped C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtlibpngd.a when searching for -lqtlibpngd C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib\libqtlibpngd.a when searching for -lqtlibpngd C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtlibpngd.a when searching for -lqtlibpngd C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtlibpngd C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtmaind.a when searching for -lqtmaind C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib\libqtmaind.a when searching for -lqtmaind C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libqtmaind.a when searching for -lqtmaind C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lqtmaind collect2.exe: error: ld returned 1 exit status

该提问来源于开源项目:xmake-io/xmake

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39777213 weixin_39777213 4月前

    不是找不到 , 你指定了mingw x84_64的工具链,但是lib路径是32位的 库和链接器不兼容

    按理-p mingw --qt这两个参数指定后 回去自动根据当前arch找对应的mingw tools目录 不用自己指定写死64位的工具链

    没必要去设置 --mingw,或者手动 -a 切下arch 确保路径和arch完全一致

    C:/Qt/Qt5.13.2/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Qt\Qt5.13.2\5.13.2\mingw73_32\lib/libQt5Cored.a when searching for -lQt5Cored

    点赞 评论 复制链接分享
  • weixin_39835158 weixin_39835158 4月前

    我电脑安装了git,所以如果使用默认的指定方式,会把mingw设置到git的路径下

    点赞 评论 复制链接分享
  • weixin_39835158 weixin_39835158 4月前

    $ xmake f -p mingw --mingw=/mingw64 -m debug --qt=C:/Qt/Qt5.13.2/5.13.2 checking for the architecture ... x86_64 checking for the mingw directory ... C:/Program Files/Git/mingw64 checking for the Qt SDK directory ... C:\Qt\Qt5.13.2\5.13.2\mingw73_32 checking for the Qt SDK version ... 5.13.2

    点赞 评论 复制链接分享
  • weixin_39777213 weixin_39777213 4月前

    你没明白我的意思,Qt sdk装完内部自带 mingw 工具链的,我看你刚的log 是装了的。。C:/Qt/Qt5.13.2/Tools/mingw730_64

    qt + mingw 有三种方式

    1. 独立安装包安装的Qt sdk + 它自带的mingw 工具链,这种你即使不在 msys2/mingw64环境下运行,直接在 cmd 下运行也可以编译,只需要 xmake f -p mingw --qt= xxx 两个参数配置

    2. 独立安装包安装的qt sdk + msys2/mingw64环境,这个时候属于混用,xmake 没做特别的支持处理,有可能支持,也可能不支持,不过需要配置对,至少arch得对上

    你刚这种就是属于这种,用了 mingw64 的mingw sdk,但是mingw 平台的arch 默认是 i386 ,你没切到 x86_64,导致 qt sdk里面找的是 mingw_32的 32位 lib库,链接器和 lib 架构不匹配。

    毕竟你虽然mingw64切过去了,qt 的 mingw 版本库,还在它自己sdk带的mingw lib里面。。

    $ xmake f -p mingw --mingw=/mingw64 -m debug --qt=C:/Qt/Qt5.13.2/5.13.2 checking for the architecture ... x86_64 checking for the mingw directory ... C:/Program Files/Git/mingw64 checking for the Qt SDK directory ... C:\Qt\Qt5.13.2\5.13.2\mingw73_32

    1. 还有一种就是通过 pacman 安装的 msys2的 qt sdk包 + mingw环境,这种,我也不确定是否支持,理论上应该可以,不过我暂时没环境测试

    所以建议通过方式1 使用 mingw + qt

    而方式2 是最不推荐,qt sdk / mingw 跟 msys/mingw 混着用。。比较蛋疼

    点赞 评论 复制链接分享
  • weixin_39835158 weixin_39835158 4月前

    嗯,好的,谢了

    点赞 评论 复制链接分享

相关推荐