Yocto构建静态库失败,并显示错误“找不到匹配项". [英] Yocto build for a static library fails with error "No Match Found"
问题描述
我正在尝试在为静态库编写的图像中包含Yocto食谱.
I am trying to include a Yocto recipe in the image which I wrote for static library.
- 在我自己的图层中创建了recipes-test/static文件夹.
- 在此文件夹中创建了"static_0.1.bb"文件
- 在"recipes-test/static"文件夹中创建的文件"文件夹
- 复制了以下文件.
hello.c
char * hello (void)
{
return "Hello";
}
world.c
char *world(void)
{
return "World";
}
helloworld.h
helloworld.h
#ifndef HELLOWORLD_H
#define HELLOWORLD_H
char * hello (void);
char * world (void);
#endif
- 创建的配方具有以下内容:
DESCRIPTION =简单的helloworld示例静态库"许可="MIT"LIC_FILES_CHKSUM =文件://$ {COMMON_LICENSE_DIR}/MIT; md5 = 0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI ="file://hello.c \file://world.c \file://helloworld.h"
DESCRIPTION = "Simple helloworld example static library"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = " file://hello.c \
file://world.c \
file://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文件夹中创建静态库
When i say bitbake static
, static library is created in the tmp/work folder
当我将其包含在conf/local.conf文件中时,其内容如下:IMAGE_INSTALL_append =静态"
When i included it in conf/local.conf file with the following line: IMAGE_INSTALL_append = " static"
在根文件创建阶段构建失败,出现以下错误:
The build fails at the root file creating stage with the following error:
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"后,出现以下错误:
Update: After changing IMAGE_INSTALL_append = " static-staticdev", i get the following error:
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)
推荐答案
Yocto会自动将安装在 $ {D}
中的文件拆分为不同的软件包.在您的情况下,helloworld.h将进入 $ {PN} -dev
(在您的情况下, $ {PN}
等于静态,但是我写$ {PN}以避免混淆)和libhelloworld.a将进入 $ {PN} -staticdev
,但是由于没有其他文件,因此将没有名为 $ {PN}
的软件包为空.
Yocto will automatically split up the files installed in ${D}
into different packages. In your case the helloworld.h will go into ${PN}-dev
(${PN}
equals static in your case, but I write ${PN} to avoid confusion) and libhelloworld.a will go into ${PN}-staticdev
, but since there's no other files there will not be a package called ${PN}
since it would be empty.
如果您确实希望静态库最终出现在图像中,请使用 IMAGE_INSTALL_append ="static-staticdev"
If you really want the static library to end up in the image, use IMAGE_INSTALL_append = "static-staticdev"
还有一个问题,普通的 $ {PN}
包中没有文件,这是默认设置,意味着不会创建此类文件.这是一个问题,因为 $ {PN} -dev
软件包对 $ {PN}
具有运行时依赖性.可以通过允许创建 $ {PN}
(即使它为空)来解决此问题,方法是添加 ALLOW_EMPTY _ $ {PN} ="1"
There's also a problem that there is no file that will be included in the plain ${PN}
package, which with the default settings means that no such package will be created. This is a problem since the ${PN}-dev
package has a runtime dependency on ${PN}
. This can be solved by allowing the creation of ${PN}
even if it's empty, enable this by adding ALLOW_EMPTY_${PN} = "1"
这篇关于Yocto构建静态库失败,并显示错误“找不到匹配项".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!