Is runtime dependency possible by including a header file?

400 views Asked by At

The case is: There is an ipk called A and another called B.
B has a runtime dependency to A (according to bitbake recipe of A)
However, a source file in B has #include <some_header_in_A>
This looks like a build dependency to me, but then I cannot explain to myself why the bitbake recipe functions with a runtime dependency.
Any help is appreciated, also a link to some explanatory tutorial.

1

There are 1 answers

0
Mike Kinghan On BEST ANSWER

Recall my answer to your other question.

  • If T DEPENDS on P then T's do_configure task is made to depend on P's do_populate_sysroot task.

  • If T RDEPENDS on P then T's do_build task ia made to depend on P's do_package_write task.

So the fact that your B RDEPENDS on your A means that A has already passed all stages right through do_package_write when B is built, including do_populate_sysroot. Therefore any headers that A exports to the sysroot will already be there when B is built, and the buildtime dependency will be satisfied.

If B includes headers exported by A, this is is a buildtime dependency. But that does not exclude B also having a runtime dependency on A. In fact it is usually the case that if B is runtime-dependent on A then it is also buildtime-dependent on A, precisely because (for C/C++ packages) the runtime dependency usually means that building B needs headers from A.

If your recipe only specifies B RDEPENDS on A, then it needs a tiny bit of luck to succeed. If it happened to be the case that B's do_configure included a check for the existence of the A headers, and all of the dependencies in play made it possible for B's do_configure to run before A's do_populate_sysroot was finished, then that that check for the A headers could fail.

For the recipe to be completely correct and safe, it should specify both that B RDEPENDS on A and that B DEPENDS on A.