简体   繁体   English

Bitbake wget:无法解析主机地址“www.nano-editor.org”

[英]Bitbake wget: unable to resolve host address ‘www.nano-editor.org’

I'm new to bitbake and working on a tutorial.我是 bitbake 的新手,正在编写教程。 I know that bitbake often comes with Yocto project but here I'm trying to use it as a stand-alone tool.我知道 bitbake 通常与 Yocto 项目一起提供,但在这里我试图将它用作独立工具。 The tutorial is connected with fetching a nano release(the text terminal editor) and building it.本教程与获取 nano 版本(文本终端编辑器)并构建它有关。 Unfortunately, I'm not able to fetch a release of nano with bitbake version 2.2, but with 1.52.0 everything is working.不幸的是,我无法使用 bitbake 版本 2.2 获取 nano 版本,但使用 1.52.0 一切正常。 In a nutshell, this is what I'm getting.简而言之,这就是我得到的。 wget: unable to resolve host address 'www.nano-editor.org'

This is the error I'm getting.这是我得到的错误。

...
DEBUG: Running export PSEUDO_DISABLED=1; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"; export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"; export PATH="/home/nikolay/linux_emb_prog/bitbake/bin:/home/nikolay/bin:~/bin:/home/nikolay/bin:~/bin:/home/nikolay/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin"; export HOME="/home/nikolay"; /usr/bin/env wget -t 2 -T 30 --passive-ftp -O /home/nikolay/linux_emb_prog/bbhello/tmp/downloads/nano-2.2.6.tar.gz.tmp -P /home/nikolay/linux_emb_prog/bbhello/tmp/downloads 'https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz' --progress=dot -v
--2023-01-07 21:50:14--  https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz
Resolving www.nano-editor.org (www.nano-editor.org)... failed: Name or service not known.
wget: unable to resolve host address ‘www.nano-editor.org’
WARNING: Failed to fetch URL https://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz, attempting MIRRORS if available
...

I get that it is something to do with my.network configuration.我知道这与 my.network 配置有关。 What I can not understand is why I'm able to build Poky but not my project.我无法理解的是为什么我能够构建 Poky 而不是我的项目。 This is my tree:这是我的树:

├── bitbake-cookerdaemon.log
├── classes
│   ├── base.bbclass
│   └── logging.bbclass
├── conf
│   ├── bblayers.conf
│   └── bitbake.conf
├── meta-hello
│   ├── conf
│   │   └── layer.conf
│   └── recipes-editor
│       └── nano
│           └── nano.bb

This is nano.bb这是纳米.bb

SUMMARY = "Recipe to build the 'nano' editor"
DESCRIPTION="nano is text terminal editor."
HOMEPAGE="www.nano-editor.org"
SUMMARY="text terminal editor"
LICENSE="GPL-3.0-or-later"

PN = "nano"
PV = "2.2.6"
P := "${PN}-${PV}"

SITE = "https://www.nano-editor.org/dist"
PV_MAJOR = "${@d.getVar('PV',True).split('.')[0]}"
PV_MINOR = "${@d.getVar('PV',True).split('.')[1]}"

SRC_URI = "${SITE}/v${PV_MAJOR}.${PV_MINOR}/${P}.tar.gz"
SRC_URI[md5sum] = "03233ae480689a008eb98feb1b599807"
SRC_URI[sha256sum] = \
"be68e133b5e81df41873d32c517b3e5950770c00fc5f4dd23810cd635abce67a"

inherit logging

python do_fetch() {
    src_uri = (d.getVar('SRC_URI', True) or "").split()
    bb.plain("Downloading source tarball from {} ...".format(src_uri))
    if len(src_uri) == 0:
        bb.fatal("Empty URI")
    try:
        fetcher = bb.fetch2.Fetch(src_uri,d)
        fetcher.download()
    except bb.fetch2.BBFetchException:
        bb.fatal("Could not fetch source tarball.")
    bb.plain("Download successful.")   
}

addtask fetch before do_build

do_unpack() {
    bbplain "Unpacking source tarball ..."
    tar x -C ${WORKDIR} -f ${DL_DIR}/${P}.tar.gz
    bbplain "Unpacked source tarball."
}

addtask unpack before do_build after do_fetch

do_configure() {
    bbplain "Configure source package ..."
    cd ${WORKDIR}/${P} && ./configure
    bbplain "Configured source package."
}

addtask configure before do_build after do_unpack

do_compile() {
    bbplain "Compiling package ..."
    cd ${WORKDIR}/${P} && make
    bbplain "Compiled package."
}

addtask compile before do_build after do_configure

do_clean[nostamp] = "1"
do_clean() {
    bbplain "cleaning ${WORKDIR}/${P} ..."
    rm -rf ${WORKDIR}/${P}
    bbplain "cleaning ${TMPDIR}/stamps/*"
    rm -f ${TMPDIR}/stamps/*

}

addtask clean

python do_testecho() {
    os.system("echo something ${WORKDIR}")
}

addtask testecho

I would appreciate any help, thanks.我将不胜感激任何帮助,谢谢。

I think, I experienced a similar issue recently.我想,我最近遇到了类似的问题。 For me, the solution was to add do_fetch.network] = "1" after my addtask fetch line in my bbclass file (where I had the fetch task defined - base.bbclass in my case).对我来说,解决方案是在我的 bbclass 文件中的addtask fetch行之后添加do_fetch.network] = "1" (我定义了 fetch 任务 - 在我的例子中是 base.bbclass )。

To me, it looks like some kind of .network" permission got introduced into bitbake at some point. I would assume that any task that wants to access the.network needs to have this property set. This would also explain why it works with an older version.对我来说,在某些时候,bitbake 似乎引入了某种 .network" 权限。我假设任何想要访问 .network 的任务都需要设置此属性。这也可以解释为什么它适用于旧版本。

But I haven't found any information about it in the documentation and I'm too lazy to look through their source-code history to find out.但是我没有在文档中找到任何关于它的信息,而且我也懒得查看他们的源代码历史来找出答案。

I tested your recipe with this solution using bitbake 2.2.1 on my machine and the fetch task worked, when I had the network property set.我在我的机器上使用 bitbake 2.2.1 使用此解决方案测试了您的配方,当我设置了network属性时,提取任务有效。

For completeness here is how I defined the fetch task:为了完整起见,这里是我定义获取任务的方式:

addtask fetch
do_fetch[dirs] = "${DL_DIR}"
do_fetch[vardeps] += "SRCREV"
do_fetch[network] = "1"
python base_do_fetch() {
    src_uri = (d.getVar('SRC_URI') or "").split()
    print("fetching: ", src_uri)
    fetcher = bb.fetch2.Fetch(src_uri, d)
    fetcher.download()
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM