简体   繁体   English

Yocto 抱怨两个配方安装了相同的 header 文件

[英]Yocto complains about two recipes installing the same header file

When building an image using bitbake , the build complains about how this particular header file (under /usr/include == kernel header file?) is being installed by both the recipes.使用bitbake构建图像时,构建抱怨这个特定的 header 文件(在/usr/include == kernel header 文件下是如何安装的?)

./tmp/work/aarch64-poky-linux/glibc/2.27-r0/temp/log.do_prepare_recipe_sysroot.21803:807:DEBUG: Removing manifest: /repo/build/tmp/work/aarch64-poky-linux/glibc/2.27-r0/recipe-sysroot/usr/include/scsi/scsi_ioctl.h

ERROR: glibc-2.27-r0 do_prepare_recipe_sysroot: The file /usr/include/scsi/scsi_ioctl.h is installed by both linux-libc-headers and glibc-initial, aborting

ERROR: glibc-2.27-r0 do_prepare_recipe_sysroot: Function failed: extend_recipe_sysroot

/tmp/work/aarch64-poky-linux/glibc/2.27-r0/temp/log.do_prepare_recipe_sysroot.16343:976:Exception: FileExistsError: [Errno 17] File exists: '/repo/build/tmp/sysroots-components/aarch64/linux-libc-headers/usr/include/scsi/scsi_ioctl.h' -> 'repo/build/tmp/work/aarch64-poky-linux/glibc/2.27-r0/recipe-sysroot/usr/include/scsi/scsi_ioctl.h'

Observation观察

I first looked for scsi_ioctl.h inside the source directory...to no avail.我首先在source目录中查找scsi_ioctl.h ......无济于事。

Then, I tried looking into the respective recipe files both of which require the .inc file so I opened that instead.然后,我尝试查看各自的配方文件,这两个文件都需要.inc文件,所以我打开了它。

  • I see glibc-initial depends on linux-libc-headers , which merely means (according to my understanding) that bitbake builds linux-libc-headers first prior to glibc-initial .我看到glibc-initial取决于linux-libc-headers ,这仅意味着(根据我的理解) bitbakeglibc-initial之前首先构建linux-libc-headers

  • linux-libc-headers removes the scsi.h . linux-libc-headers删除scsi.h (Not sure if it's related to the current header it's complaining about) (不确定它是否与它抱怨的当前 header 有关)

  • I also see a long note in linux-libc-headers.inc that talks about how you do not have to add libc custom extensions to the kernel.我还在linux-libc-headers.inc中看到了一个很长的注释,它谈到了如何不必将libc自定义扩展添加到 kernel。 In addition, it says if you need to use kernel drivers, get them from STAGING_KERNEL_DIR , which is set in bitbake.conf to "${TMPDIR}/work-shared/${MACHINE}/kernel-source" , and I already see scsi_ioctl.h is located there.此外,它说如果您需要使用 kernel 驱动程序,请从STAGING_KERNEL_DIR获取它们,它在bitbake.conf中设置为"${TMPDIR}/work-shared/${MACHINE}/kernel-source" ,我已经看到了scsi_ioctl.h位于那里。

// glibc-initial.inc
DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial libgcc-initial"
PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"

....
do_install () {
        oe_runmake cross-compiling=yes install_root=${D} \
        includedir='${includedir}' prefix='${prefix}' \
        install-bootstrap-headers=yes install-headers

        oe_runmake csu/subdir_lib
        mkdir -p ${D}${libdir}/
        install -m 644 csu/crt[1in].o ${D}${libdir}
// linux-libc-headers.inc 
do_install() {
        oe_runmake headers_install INSTALL_HDR_PATH=${D}${exec_prefix}
        # Kernel should not be exporting this header
        rm -f ${D}${exec_prefix}/include/scsi/scsi.h

        # The ..install.cmd conflicts between various configure runs
        find ${D}${includedir} -name ..install.cmd | xargs rm -f
}

#########################################################################
####                        PLEASE READ
#########################################################################
#
# You're probably looking here thinking you need to create some new copy
# of linux-libc-headers since you have your own custom kernel. To put
# this simply, you DO NOT.
#
# Why? These headers are used to build the libc. If you customise the
# headers you are customising the libc and the libc becomes machine
# specific. Most people do not add custom libc extensions to the kernel
# and have a machine specific libc.
#
# But you have some kernel headers you need for some driver? That is fine
# but get them from STAGING_KERNEL_DIR where the kernel installs itself.
# This will make the package using them machine specific but this is much
# better than having a machine specific C library. This does mean your
# recipe needs a
#    do_configure[depends] += "virtual/kernel:do_shared_workdir"
# but again, that is fine and makes total sense.
#
# There can also be a case where your kernel extremely old and you want
# an older libc ABI for that old kernel. The headers installed by this
# recipe should still be a standard mainline kernel, not your own custom
# one.

Question/Concern问题/关注

  • if the recipes themselves aren't installing the header file, who else may be?如果食谱本身没有安装 header 文件,还有谁? I am missing out on the point but that's because I'm still new to yocto and trying to figure things out.我错过了这一点,但那是因为我还是 yocto 的新手并试图弄清楚事情。
  • Shouldn't yocto be looking into the build/tmp/work/<machine-name> and not build/tmp/work/aarch64-poky-linux , where <machine-name> is whatever it's set to in build/conf/local.conf file, which isn't aarch64 yocto 不应该查看build/tmp/work/<machine-name>而不是build/tmp/work/aarch64-poky-linux ,其中<machine-name>是它在build/conf/local.conf中设置的任何内容build/conf/local.conf文件,它不是aarch64

Appreciate any help感谢任何帮助

Please specify what version of yocto (gatesgarth etc) you are using.请指定您使用的是什么版本的 yocto(gatesgarth 等)。

As glibc is a very common package, I assume something has gotten messed up with your yocto tmp directory rather than a problem with yocto itself.由于 glibc 是一个非常常见的 package,我认为您的 yocto tmp目录已经搞砸了,而不是 yocto 本身的问题。 (In my dunfell build, scsi_ioctl.h appears only under the glibc recipe.) Current yocto builds a distinct sysroot for each package, but in earlier versions used a common sysroot and it was rather fragile. (在我的 dunfell 构建中, scsi_ioctl.h仅出现在 glibc 配方下。)当前的 yocto 为每个 package 构建了一个不同的 sysroot,但在早期版本中使用了一个通用的 sysroot,它相当脆弱。

You can try:你可以试试:

bitbake -c cleanall glibc
bitbake -c cleanall linux-libc-headers

then rebuild.然后重建。 If that doesn't work, you can try the nuclear option of renaming tmp to some other name and re-running your build.如果这不起作用,您可以尝试将tmp重命名为其他名称并重新运行您的构建的核选项。 If you've been using the same tmp through more than one yocto version or more than one kernel recipe, I definitely recommend a fresh start.如果您通过多个 yocto 版本或多个 kernel 配方使用相同的tmp ,我绝对建议您重新开始。

Re: tmp/work/<machine> vs tmp/work/<arch> ;回复: tmp/work/<machine> vs tmp/work/<arch> yocto tries to reuse build products as widely as possible. yocto 尝试尽可能广泛地重用构建产品。 If a package is machine-specific (eg the kernel and device tree) it gets built under tmp/work/<machine> .如果 package 是特定于机器的(例如 kernel 和设备树),它将在tmp/work/<machine>下构建。 If it is architecture-specific (eg compiled C code) but not machine-specific, it gets built under tmp/work/<arch> .如果它是特定于架构的(例如编译的 C 代码)但不是特定于机器的,它会在tmp/work/<arch>下构建。 A few packages (eg ca-certificates ) are platform-independent, and are built in a tmp/work/<all> directory.一些软件包(例如ca-certificates )与平台无关,并且构建在tmp/work/<all>目录中。

We build for several different Cortex A8 machines;我们为几种不同的 Cortex A8 机器构建; most packages end up in tmp/work/coretexta8hf-neon-linux-gnueabi but a handful of packages have machine-specific overrides and end up in the machine-specific directories.大多数软件包最终位于tmp/work/coretexta8hf-neon-linux-gnueabi但少数软件包具有特定于机器的覆盖并最终位于特定于机器的目录中。

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

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