Yocto build for a static library fails with error “No Match Found”

柔情痞子 提交于 2021-01-29 17:46:56

问题


I am trying to include a Yocto recipe in the image which I wrote for static library.

  1. Created recipes-test/static folder in my own layer .
  2. Created 'static_0.1.bb' file in this folder
  3. Created 'files' folder inside the 'recipes-test/static' folder
  4. Copied the below files.

hello.c

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

world.c

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

helloworld.h

#ifndef HELLOWORLD_H
#define HELLOWORLD_H
char * hello (void);
char * world (void);
#endif
  1. Created recipe with the following content:

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}
}

When i say bitbake static , static library is created in the tmp/work folder

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

Can you please help me to resolve the error

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)

回答1:


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.

If you really want the static library to end up in the image, use IMAGE_INSTALL_append = "static-staticdev"

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"



来源:https://stackoverflow.com/questions/56845122/yocto-build-for-a-static-library-fails-with-error-no-match-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!