使用 bitbake 构建 Yocto 项目

问题描述 投票:0回答:1

我很长一段时间以来一直在尝试使用

Yocto
构建
bitbake
项目(确切地说是“core-image-minimal”),并且我总是遇到相同的错误,例如:


WARNING: linux-yocto-6.6.43+git-r0 do_fetch: Failed to fetch URL git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=v6.6/standard/base;protocol=https, attempting MIRRORS if available
ERROR: netbase-1_6.4-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/netbase/6.4/temp/log.do_package.13831
ERROR: Task (/root/yocto/poky/meta/recipes-core/netbase/netbase_6.4.bb:do_package) failed with exit code '1'
ERROR: update-rc.d-0.8+git-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 801, function: sstate_task_postfunc
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
0800:
*** 0801: sstate_installpkgdir(shared_state, d)
0802:
0803: bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
0804:}
0805:sstate_task_postfunc[dirs] = "${WORKDIR}"
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 416, function: sstate_installpkgdir
0412: for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
0413: # All hooks should run in the SSTATE_INSTDIR
0414: bb.build.exec_func(f, d, (sstateinst,))
0415:
*** 0416: sstate_install(ss, d)
0417:
0418: return True
0419:
0420:python sstate_hardcode_path_unpack () {
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 350, function: sstate_install
0346: src = sstateinst + "/" + plain.replace(sharedworkdir, '')
0347: dest = plain
0348: bb.utils.mkdirhier(src)
0349: prepdir(dest)
*** 0350: bb.utils.rename(src, dest)
0351:
0352: for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split():
0353: # All hooks should run in the SSTATE_INSTDIR
0354: bb.build.exec_func(postinst, d, (sstateinst,))
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/sstate-build-package///package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/update-rc.d/0.8+git/temp/log.do_package.13830
ERROR: Task (/root/yocto/poky/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb:do_package) failed with exit code '1'
ERROR: base-files-3.0.14-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/package' -> '/root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/qemux86_64-poky-linux/base-files/3.0.14/temp/log.do_package.13826
ERROR: Task (/root/yocto/poky/meta/recipes-core/base-files/base-files_3.0.14.bb:do_package) failed with exit code '1'
ERROR: initscripts-1.0-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/package' -> '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/core2-64-poky-linux/initscripts/1.0/temp/log.do_package.13827
ERROR: Task (/root/yocto/poky/meta/recipes-core/initscripts/initscripts_1.0.bb:do_package) failed with exit code '1'
ERROR: ca-certificates-20240203-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/package' -> '/root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/all-poky-linux/ca-certificates/20240203/temp/log.do_package.14556
ERROR: Task (/root/yocto/poky/meta/recipes-support/ca-certificates/ca-certificates_20240203.bb:do_package) failed with exit code '1'
ERROR: linux-libc-headers-6.10-r0 do_package: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:sstate_task_postfunc(d)
0003:
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 795, function: sstate_task_postfunc
0791:
0792: omask = os.umask(0o002)
0793: if omask != 0o002:
0794: bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
*** 0795: sstate_package(shared_state, d)
0796: os.umask(omask)
0797:
0798: sstateinst = d.getVar("SSTATE_INSTDIR")
0799: d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
File: '/root/yocto/poky/meta/classes-global/sstate.bbclass', lineno: 692, function: sstate_package
0688: if sharedworkdir in plain:
0689: pdir = plain.replace(sharedworkdir, sstatebuild)
0690: bb.utils.mkdirhier(plain)
0691: bb.utils.mkdirhier(pdir)
*** 0692: bb.utils.rename(plain, pdir)
0693: if fixtime:
0694: fixtimestamp(pdir, "")
0695: for walkroot, dirs, files in os.walk(pdir):
0696: for file in files + dirs:
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1781, function: rename
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
1780: else:
*** 1781: raise err
1782:
1783:@contextmanager
1784:def environment(**envvars):
1785: """
File: '/root/yocto/poky/bitbake/lib/bb/utils.py', lineno: 1775, function: rename
1771:# Wrapper around os.rename which can handle cross device problems
1772:# e.g. from container filesystems
1773:def rename(src, dst):
1774: try:
*** 1775: os.rename(src, dst)
1776: except OSError as err:
1777: if err.errno == 18:
1778: # Invalid cross-device link error
1779: shutil.move(src, dst)
Exception: PermissionError: [Errno 13] Permission denied: '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/package' -> '/root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/sstate-build-package//package'

ERROR: Logfile of failure stored in: /root/yocto/poky/build/tmp/work/core2-64-poky-linux/linux-libc-headers/6.10/temp/log.do_package.13822

我对这个问题确实没有任何想法,我已经探索过的论坛无法帮助我。可以用它做什么?

我尝试对项目目录执行“chmod”,添加一些镜像和哈希服务器,按照指南进行操作,但没有给出任何结果。

yocto bitbake yocto-layer
1个回答
0
投票

嗯,我已经以某种方式构建了它。我希望我的建议能有所帮助,因为我见过很多有同样问题的人。

1。如果你像我一样使用 wsl 将其更新为 wsl 2

按照 Katu 的建议,我创建了一个新用户,尝试对图像进行 bitbake,但出现了一个我从未见过的新错误:

OpenEmbedded doesn't work under wslv1, please upgrade to wslv2 if you want to run builds on windows
。你可以找到一些指南,这并不难,但是单独的,例如我被迫重新安装我的 Ubuntu

2。创建新用户

adduser <yourusername>
usermod -aG sudo <yourusername>
sudo - <yourusername>

3.检查你的记忆和来源

可能是你的机器内存和资源不够。当构建失败时,输入

free -h
查看可用内存。如果 swap 为零,那么您应该通过创建交换文件来增加它:

sudo fallocate -l 8G /swapfile #for ex
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab #do not sure about this step

您还可以在

BB_NUMBER_THREADS
中设置较小的
PARALLEL_MAKE
/build/conf/local.conf
值,并使用不太激进的处理器优化,例如 O2:
CXXFLAGS="-O2" bitbake <target>

4。单独搭建

有一些非常大且昂贵的任务可能会加重您的系统负载。在这种情况下,您应该知道哪个任务导致了跌倒(根据我的经验,它通常类似于

do_compile
),然后找到该任务正在执行的确切配方(使用
bitbake-layers show-recipes
)并将其设置为
bitbake的简单目标
。就我而言,
llvm-native
有问题,所以我做了
bitbake llvm-native
。在此之前,您可以制作一个干净的集合:
bitbake -c cleanall llvm-native
以确保您拥有正确的
llvm-native
文件。此操作可能会被请求多次,与大型任务的数量一样多。

同时在

/build/conf/local.conf
中设置镜像:SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"

我希望这对那些初学者有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.