【问题标题】:Yocto build for a static library fails with error "No Match Found"为静态库构建 Yocto 失败并出现错误“未找到匹配项”
【发布时间】:2019-11-12 16:02:10
【问题描述】:

我正在尝试在我为静态库编写的图像中包含一个 Yocto 配方。

  1. 在我自己的层中创建了 recipes-test/static 文件夹。
  2. 在此文件夹中创建了“static_0.1.bb”文件
  3. 在“recipes-test/static”文件夹中创建了“files”文件夹
  4. 复制了以下文件。

你好.c

char * hello (void)
{
  return "Hello";
}

世界.c

char *world(void)
{
  return "World";
}

helloworld.h

#ifndef HELLOWORLD_H
#define HELLOWORLD_H
char * hello (void);
char * world (void);
#endif
  1. 创建的配方包含以下内容:

DESCRIPTION = "简单的 helloworld 示例静态库" 许可证=“麻省理工学院” LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = " file://hello.c \ 文件://world.c \ 文件://helloworld.h"

S = "${WORKDIR}"

do_compile() {
        ${CC} -c hello.c world.c
        ${AR} -cvq libhelloworld.a hello.o world.o
}

do_install() {
        install -d ${D}${includedir}
        install -d ${D}${libdir}
        install -m 0755 helloworld.h ${D}${includedir}
        install -m 0755 libhelloworld.a ${D}${libdir}
}

当我说 bitbake static 时,在 tmp/work 文件夹中创建静态库

当我使用以下行将它包含在 conf/local.conf 文件中时: IMAGE_INSTALL_append = "静态"

在根文件创建阶段构建失败并出现以下错误:

not found other for: 
not found modules for: 
not found deltainfo for: 
not found updateinfo for: 
oe-repo: using metadata from Tue 02 Jul 2019 03:54:50 AM UTC.
No module defaults found
No match for argument: static
Error: Unable to find a match

你能帮我解决这个错误吗

更新:更改 IMAGE_INSTALL_append = " static-staticdev" 后,出现以下错误:

No module defaults found
--> Starting dependency resolution
--> Finished dependency resolution
Error: 
 Problem: package static-staticdev-0.1-r0.cortexa7t2hf_neon_vfpv4 requires static-dev = 0.1-r0, but none of the providers can be installed
  - conflicting requests
  - nothing provides static = 0.1-r0 needed by static-dev-0.1-r0.cortexa7t2hf_neon_vfpv4
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

【问题讨论】:

    标签: linux embedded-linux libraries yocto


    【解决方案1】:

    Yocto 会自动将安装在${D} 中的文件拆分到不同的包中。在你的情况下,helloworld.h 将进入${PN}-dev${PN} 在你的情况下等于静态,但我写 ${PN} 以避免混淆)和 libhelloworld.a 将进入${PN}-staticdev,但因为没有其他文件不会有一个名为 ${PN} 的包,因为它是空的。

    如果您真的希望静态库最终出现在图像中,请使用IMAGE_INSTALL_append = "static-staticdev"

    还有一个问题是没有文件将包含在普通的${PN} 包中,默认设置意味着不会创建这样的包。这是一个问题,因为${PN}-dev 包在运行时依赖于${PN}。这可以通过允许创建 ${PN} 来解决,即使它是空的,通过添加 ALLOW_EMPTY_${PN} = "1" 来启用它

    【讨论】:

    • 感谢您的详细解释。更新到 static-staticdev 后,我收到一个新错误。我该如何调试这个
    • @md.jamal 更新了答案以包含新错误的解决方案。
    猜你喜欢
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-01
    • 2020-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多