Search code examples
packageyoctodynamic-librarybitbakeopenembedded

BitBake: example not found in the base feeds


I have a BitBake recipe (example_0.1.bb) with a do_install task where I attempt to install a .so file:

do_install() {
    install -d ${D}${libdir}
    install -m 0644 ${S}/example.so ${D}${libdir} 
}
FILES_${PN} += "${libdir}/example.so"

This fails during the build process and returns:

ERROR: example not found in the base feeds   

However, if I add a test file to the package, both the .so file and the test file are added to the rootfs.

do_install() {
    install -d ${D}${libdir}
    install -m 0644 ${S}/example.so ${D}${libdir} 
    echo "bar" >> ${TOPDIR}/foo
    install -m 0644 ${TOPDIR}/foo ${D}${libdir} 
}
FILES_${PN} += "${libdir}/libceill.so"
FILES_${PN} += "${libdir}/foo"

How can I add only the .so file without the junk test file?


Solution

  • So you've got a library that is non-standard in that it's not installing a versioned library (libfoo.so.1.2.3, maybe symlinks such as libfoo.so.1 -> libfoo.so.1.2.3), and then an unversioned symlink for compilation time (libfoo.so -> libfoo.so.1). The default packaging rules assume standard libraries.

    What's happening is that packages are populated by their order in PACKAGES, which has PN-dev before PN. FILES_PN-dev by default contains /usr/lib/lib*.so, and FILES_PN contains /usr/lib/lib*.so.. When you add /usr/lib/lib.so to FILES_PN what you want to happen isn't happening because PN-dev has already taken the files.

    If your library doesn't come with any development files at all (e.g. no headers) then you can set FILES_${PN}-dev = "" to empty that package, and then your addition of lib*.so to FILES_${PN} will work as expected.

    Yes, this is something that we should make easier (I've been thinking about a small class for libraries like this) and warn in sanity checks when it happens.

    Oh and I'm surprised that the library ends up in the image in your second example, as example will contain /usr/lib/foo and example-dev will contains /usr/lib/libceill.so. Unless of course you've got dev-pkgs enabled, which will automatically install example-dev if you've got example in an image.