Reputation: 1320
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?
Upvotes: 0
Views: 2837
Reputation: 343
Add the line: FILES_${PN}_dev_remove="${FILES_SOLIBDEV} " It will move out the package for development path.
Upvotes: 1
Reputation: 4053
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.
Upvotes: 5
Reputation: 1320
Add the line
FILES_SOLIBSDEV = ""
An explanation from the Yocto mailing list:
I had FILES_${PN} += “${libdir}/.so” in there and that didn't work. Maybe it was because I was missing the FILES_SOLIBSDEV = “" you mentioned. I'll play with it some more and see what happens. I first started out with FILES_${PN} += “${libdir}/.so” and when that didn't work I tried other things in the FILES_${PN} = line to try and get it picked up. When I couldn't get any of it to work and then saw others (well, at least the link I provided) were seeing the same thing I figured it was time to quit spinning my wheels and consult the big guns :)
Heh :) The issue there is that the patterns are matched in the order of the PACKAGES variable. The first package to include a file gets it, and ${PN}-dev is in PACKAGES before ${PN}. By emptying FILES_SOLIBSDEV, that’ll remove the .so from FILES_${PN}-dev, letting the ${PN} package get it instead.
Upvotes: 1