Qt6.4.1源码编译时出现目标冲突问题求助
Qt源码编译configure阶段目标冲突问题解决
问题分析
你遇到的Bundled_Poly2Tri目标重复和PositioningQuick输出目录冲突,是因为Qt的qtlocation和qtpositioning模块都内置了poly2tri第三方库,默认编译时两个模块会同时构建,导致CMake目标名重复;后者则是重复生成QML模块输出目录引发的冲突,且该问题在Qt 6.3/6.4版本、跨平台(Windows/Linux)都存在。
解决方法
1. 跳过冲突模块
configure时添加-skip qtlocation参数,跳过qtlocation模块的构建,这样只有qtpositioning会编译poly2tri库,避免目标名重复:
c:\Qt\Qt6.4.1>configure -debug-and-release -prefix %CD%/qtbase -opensource -opengl desktop -nomake examples -nomake tests -skip qtlocation
2. 清理旧构建缓存
如果之前有过失败的构建尝试,残留的CMake缓存会干扰新的构建流程,直接删除当前的build目录,或者在configure时指定新的构建目录:
c:\Qt\Qt6.4.1>configure -debug-and-release -prefix %CD%/qtbase -opensource -opengl desktop -nomake examples -nomake tests -skip qtlocation -build build_new
3. 确保子模块完整
检查仓库子模块是否拉取完整,执行以下命令更新所有子模块:
git submodule update --init --recursive
缺失子模块可能导致依赖解析异常,进而引发类似的冲突问题。
内容的提问来源于stack exchange,提问作者Lolitron
相关产品推荐
相关产品推荐

