Yocto Kirkstone编译twin组件时SRCREV配置错误求助
解决Yocto Kirkstone编译twin recipe时的SRCREV错误
问题原因
你的twin.bb配方中指定了多个Git仓库作为构建源,但未正确为每个仓库单独绑定对应的提交版本(SRCREV)。BitBake无法将全局SRCREV映射到具体仓库,因此抛出该错误。
解决方案
1. 调整SRC_URI配置,为仓库命名
在twin.bb中,给每个Git仓库添加唯一的name参数,让BitBake能区分不同源:
SRC_URI = " \ git://github.com/bernar0507/Automate-Twin-Process.git;protocol=https;name=autotwin;branch=main \ git://github.com/eclipse-ditto/ditto.git;protocol=https;branch=main;name=ditto \ git://github.com/bernar0507/Eclipse-Ditto-MQTT-iwatch-SSL-TCP.git;protocol=https;name=mqttwatch;branch=main \ "
2. 为每个仓库单独设置SRCREV
在twin.bb中添加与name对应的SRCREV变量,替换为各仓库实际的提交哈希(可通过git log --oneline或GitHub仓库页面复制):
# 替换为对应仓库的有效提交哈希 SRCREV_autotwin = "abc1234567890abcdef1234567890abcdef123456" SRCREV_ditto = "def4567890abcdef1234567890abcdef123456789" SRCREV_mqttwatch = "ghi7890abcdef1234567890abcdef1234567890"
3. 备选方案:直接在URL中指定rev参数
若不想单独维护SRCREV变量,可直接在Git URL后追加;rev=<commit-hash>:
SRC_URI = " \ git://github.com/bernar0507/Automate-Twin-Process.git;protocol=https;branch=main;rev=abc1234567890abcdef1234567890abcdef123456 \ git://github.com/eclipse-ditto/ditto.git;protocol=https;branch=main;rev=def4567890abcdef1234567890abcdef123456789 \ git://github.com/bernar0507/Eclipse-Ditto-MQTT-iwatch-SSL-TCP.git;protocol=https;branch=main;rev=ghi7890abcdef1234567890abcdef1234567890 \ "
4. 验证修复效果
清理旧构建缓存后重新编译:
bitbake -c cleanall twin bitbake twin
注意事项
- 避免用
HEAD作为SRCREV,动态引用会导致构建不稳定,建议使用固定的提交哈希。 - 若
twin配方不需要全部三个仓库,可移除多余的SRC_URI条目,简化配置。
内容的提问来源于stack exchange,提问作者Coder101
相关产品推荐
相关产品推荐

