How do I figure out what is causing a recipe to be included?

Viewed 971

I am working on a yocto project and in my custom layer, I have dozens of recipes. A couple recipes are still under development and were not listed in the my image's recipe. However one broken recipe is still being pulled into the build. I have deleted by build/tmp directory as well as my state cache and rebuilt. But the bad recipe is still being pulled in. How do I figure out what is pulling in this bad recipe? bitbake -e doesn't show my recipe at all.

I was able to figure it out by shear luck, so I'm really asking for debug skills on doing this in the future. In my case, the bad recipe had a dozen or so PROVIDES, and another recipe was DEPENDing on one of those. Is there a way to get bitbake to indicate why a recipe is being baked? something like "Compling lib_bad.bb because lib_good.bb depends on it"

2 Answers

You can generate dependacy graph:

bitbake -g <packagename>
vim task-depends.dot

or graphical version (graphviz):

bitbake -g <packagename> -u taskexp

So to answer my own question, there are a few things to offer: https://docs.yoctoproject.org/what-i-wish-id-known.html My question is basically the crux of item #8 on that list. So here is what I could have done to expedite solving the mystery.

When you run bitbake -g core-image-minimal you get two files in the build directory: task-depends.dot and pn-buildlist.

Then look in the task-depends.dot file and search for the package. grep <package> task-depends.dot The first search results are going to show several entries for the culprit package that is pulling in the bad package.

~/poky/build$ grep lib_bad task-depends.dot
"lib_good.do_build" -> "lib_bad.do_package_write_deb"
"lib_good.do_package" -> "lib_bad.do_packagedata"
"lib_good.do_prepare_recipe_sysroot" -> "lib_bad.do_populate_sysroot"
"lib_bad.do_build" -> "autoconf.do_package_write_deb"
etc...

So after search the dependency graph, we can see that lib_good is somehow pulling lib_bad into the build. The next step will be to look in that recipe for its DEPENDS or RDEPENDS variables, and compare them with what lib_bad has in its PROVIDES variable.

Related