You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Yocto构建gnu-config-native时出现URL获取失败错误求解决

解决bitbake gnu-config-native资源获取失败的思路

执行bitbake gnu-config-native时出现Git资源拉取失败,对应的配方代码如下:

SUMMARY = "gnu-configize"
DESCRIPTION = "Tool that installs the GNU config.guess / config.sub into a directory tree"
HOMEPAGE = "https://git.savannah.gnu.org/cgit/config.git"
SECTION = "devel"
LICENSE = "GPL-3.0-with-autoconf-exception"
LIC_FILES_CHKSUM = "file://config.guess;beginline=7;endline=27;md5=b75d42f59f706ea56d6a8e00216fca6a"

DEPENDS_class-native = "hostperl-runtime-native"

INHIBIT_DEFAULT_DEPS = "1"

SRCREV = "5256817ace8493502ec88501a19e4051c2e220b0"
PV = "20200117+git${SRCPV}"

SRC_URI = "git://git.savannah.gnu.org/git/config.git;protocol=https;branch=master \
           file://gnu-configize.in \
          "

S = "${WORKDIR}/git"
UPSTREAM_CHECK_COMMITS = "1"

CLEANBROKEN = "1"

do_compile[noexec] = "1"

do_install () {
    install -d ${D}${datadir}/gnu-config \
           ${D}${bindir}
    cat ${WORKDIR}/gnu-configize.in | \
        sed -e 's,@gnu-configdir@,${datadir}/gnu-config,g' \
            -e 's,@autom4te_perllibdir@,${datadir}/autoconf,g' > ${D}${bindir}/gnu-configize
    # In the native case we want the system perl as perl-native can't have built yet
    if [ "${PN}" != "gnu-config-native" -a "${PN}" != "nativesdk-gnu-config" ]; then
        sed -i -e 's,/usr/bin/env,${bindir}/env,g' ${D}${bindir}/gnu-configize
    fi
    chmod 755 ${D}${bindir}/gnu-configize
    install -m 0644 config.guess config.sub ${D}${datadir}/gnu-config/
}

PACKAGES = "${PN}"
FILES_${PN} = "${bindir} ${datadir}/gnu-config"

BBCLASSEXTEND = "native nativesdk"

抛出的错误与警告:

WARNING: gnu-config-native-20200117+gitAUTOINC+5256817ace-r0 do_fetch: Failed to fetch URL git://git.savannah.gnu.org/git/config.git;protocol=https;branch=master, attempting MIRRORS if available
ERROR: gnu-config-native-20200117+gitAUTOINC+5256817ace-r0 do_fetch: Bitbake Fetcher Error: FetchError('Unable to fetch URL from any source.', 'git://git.savannah.gnu.org/git/config.git;protocol=https;branch=master')

以下是具体解决思路:

  • 网络连通性校验
    手动执行git clone https://git.savannah.gnu.org/git/config.git,确认能否正常克隆仓库。如果失败:

    • 检查防火墙、代理是否拦截了HTTPS请求;
    • 若使用代理,在conf/local.conf中添加代理配置:
      HTTP_PROXY="http://your-proxy-addr:port"
      HTTPS_PROXY="http://your-proxy-addr:port"
      
  • 调整Git源URL格式
    将配方中SRC_URI的Git地址直接修改为纯HTTPS格式,避免协议转换的潜在问题:

    SRC_URI = "https://git.savannah.gnu.org/git/config.git;branch=master \
               file://gnu-configize.in \
              "
    
  • 本地预克隆仓库供BitBake调用

    1. 手动克隆仓库到本地指定路径并切换到目标提交:
      git clone https://git.savannah.gnu.org/git/config.git /home/your-user/local-config-repo
      cd /home/your-user/local-config-repo
      git checkout 5256817ace8493502ec88501a19e4051c2e220b0
      
    2. 在conf/local.conf中添加覆盖配置,让BitBake直接使用本地仓库:
      SRC_URI_OVERRIDES="git://git.savannah.gnu.org/git/config.git=file:///home/your-user/local-config-repo"
      
  • 校验BitBake Fetcher配置
    执行bitbake -e gnu-config-native | grep FETCHCMD_git,确认FETCHCMD_git指向系统正常的Git命令;同时确保BB_FETCHERS包含git,可在local.conf中添加BB_FETCHERS += "git"确保启用。

  • 确认SRCREV有效性
    检查5256817ace8493502ec88501a19e4051c2e220b0这个提交ID是否存在于远程仓库的master分支。如果提交已被移除,需更新SRCREV为当前分支的有效提交哈希。

内容的提问来源于stack exchange,提问作者Manu Mamman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 14:45:27