poky/documentation/getting-started/eclipse/html/getting-started/automatically-added-runtime-dependencies.html
Scott Rifenbark ae06e04cd2 documentation: Created new "Getting Started" manual.
Creation involved removing the overview-manual and replacing it
with the getting-started manual.  All links to the string
"&YOCTO_DOCS_OVERVIEW_URL" had to be replaced with
"&YOCTO_DOCS_GS_URL" across the entire YP manual set.  I renamed
files used to create the manual with prefixes suited for the
new manual name, which is "Getting Started With Yocto Project".

The style sheet for the new manual needed updating to display the
new .PNG image for the title page.  The mega-manual file had to
be updated to include the files.  The mega-manual.sed file had
to be updated to include the new manual and not use the overview
manual.

(From yocto-docs rev: 6c7abf9192390121000f577d6c98f259d290d15d)

Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-14 15:25:29 +00:00

165 lines
10 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.4. Automatically Added Runtime Dependencies</title>
<link rel="stylesheet" type="text/css" href="../book.css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="Getting Started With Yocto Project">
<link rel="up" href="overview-concepts.html" title="Chapter 3. Yocto Project Concepts">
<link rel="prev" href="invalidating-shared-state.html" title="3.3.4.2. Invalidating Shared State">
<link rel="next" href="fakeroot-and-pseudo.html" title="3.5. Fakeroot and Pseudo">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" title="3.4. Automatically Added Runtime Dependencies">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="automatically-added-runtime-dependencies"></a>3.4. Automatically Added Runtime Dependencies</h2></div></div></div>
<p>
The OpenEmbedded build system automatically adds common types of
runtime dependencies between packages, which means that you do not
need to explicitly declare the packages using
<a class="link" href="../ref-manual/var-RDEPENDS.html" target="_self"><code class="filename">RDEPENDS</code></a>.
Three automatic mechanisms exist (<code class="filename">shlibdeps</code>,
<code class="filename">pcdeps</code>, and <code class="filename">depchains</code>)
that handle shared libraries, package configuration (pkg-config)
modules, and <code class="filename">-dev</code> and
<code class="filename">-dbg</code> packages, respectively.
For other types of runtime dependencies, you must manually declare
the dependencies.
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
<code class="filename">shlibdeps</code>:
During the
<a class="link" href="../ref-manual/ref-tasks-package.html" target="_self"><code class="filename">do_package</code></a>
task of each recipe, all shared libraries installed by the
recipe are located.
For each shared library, the package that contains the
shared library is registered as providing the shared
library.
More specifically, the package is registered as providing
the
<a class="ulink" href="https://en.wikipedia.org/wiki/Soname" target="_self">soname</a>
of the library.
The resulting shared-library-to-package mapping
is saved globally in
<a class="link" href="../ref-manual/var-PKGDATA_DIR.html" target="_self"><code class="filename">PKGDATA_DIR</code></a>
by the
<a class="link" href="../ref-manual/ref-tasks-packagedata.html" target="_self"><code class="filename">do_packagedata</code></a>
task.</p>
<p>Simultaneously, all executables and shared libraries
installed by the recipe are inspected to see what shared
libraries they link against.
For each shared library dependency that is found,
<code class="filename">PKGDATA_DIR</code> is queried to
see if some package (likely from a different recipe)
contains the shared library.
If such a package is found, a runtime dependency is added
from the package that depends on the shared library to the
package that contains the library.</p>
<p>The automatically added runtime dependency also
includes a version restriction.
This version restriction specifies that at least the
current version of the package that provides the shared
library must be used, as if
"<em class="replaceable"><code>package</code></em> (&gt;= <em class="replaceable"><code>version</code></em>)"
had been added to
<a class="link" href="../ref-manual/var-RDEPENDS.html" target="_self"><code class="filename">RDEPENDS</code></a>.
This forces an upgrade of the package containing the shared
library when installing the package that depends on the
library, if needed.</p>
<p>If you want to avoid a package being registered as
providing a particular shared library (e.g. because the library
is for internal use only), then add the library to
<a class="link" href="../ref-manual/var-PRIVATE_LIBS.html" target="_self"><code class="filename">PRIVATE_LIBS</code></a>
inside the package's recipe.
</p>
</li>
<li class="listitem">
<p>
<code class="filename">pcdeps</code>:
During the
<a class="link" href="../ref-manual/ref-tasks-package.html" target="_self"><code class="filename">do_package</code></a>
task of each recipe, all pkg-config modules
(<code class="filename">*.pc</code> files) installed by the recipe
are located.
For each module, the package that contains the module is
registered as providing the module.
The resulting module-to-package mapping is saved globally in
<a class="link" href="../ref-manual/var-PKGDATA_DIR.html" target="_self"><code class="filename">PKGDATA_DIR</code></a>
by the
<a class="link" href="../ref-manual/ref-tasks-packagedata.html" target="_self"><code class="filename">do_packagedata</code></a>
task.</p>
<p>Simultaneously, all pkg-config modules installed by
the recipe are inspected to see what other pkg-config
modules they depend on.
A module is seen as depending on another module if it
contains a "Requires:" line that specifies the other module.
For each module dependency,
<code class="filename">PKGDATA_DIR</code> is queried to see if some
package contains the module.
If such a package is found, a runtime dependency is added
from the package that depends on the module to the package
that contains the module.
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
The <code class="filename">pcdeps</code> mechanism most often
infers dependencies between <code class="filename">-dev</code>
packages.
</div>
<p>
</p>
</li>
<li class="listitem">
<p>
<code class="filename">depchains</code>:
If a package <code class="filename">foo</code> depends on a package
<code class="filename">bar</code>, then <code class="filename">foo-dev</code>
and <code class="filename">foo-dbg</code> are also made to depend on
<code class="filename">bar-dev</code> and
<code class="filename">bar-dbg</code>, respectively.
Taking the <code class="filename">-dev</code> packages as an
example, the <code class="filename">bar-dev</code> package might
provide headers and shared library symlinks needed by
<code class="filename">foo-dev</code>, which shows the need
for a dependency between the packages.</p>
<p>The dependencies added by
<code class="filename">depchains</code> are in the form of
<a class="link" href="../ref-manual/var-RRECOMMENDS.html" target="_self"><code class="filename">RRECOMMENDS</code></a>.
</p>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
By default, <code class="filename">foo-dev</code> also has an
<code class="filename">RDEPENDS</code>-style dependency on
<code class="filename">foo</code>, because the default value of
<code class="filename">RDEPENDS_${PN}-dev</code> (set in
<code class="filename">bitbake.conf</code>) includes
"${PN}".
</div>
<p>To ensure that the dependency chain is never broken,
<code class="filename">-dev</code> and <code class="filename">-dbg</code>
packages are always generated by default, even if the
packages turn out to be empty.
See the
<a class="link" href="../ref-manual/var-ALLOW_EMPTY.html" target="_self"><code class="filename">ALLOW_EMPTY</code></a>
variable for more information.
</p>
</li>
</ul></div>
<p>
</p>
<p>
The <code class="filename">do_package</code> task depends on the
<a class="link" href="../ref-manual/ref-tasks-packagedata.html" target="_self"><code class="filename">do_packagedata</code></a>
task of each recipe in
<a class="link" href="../ref-manual/var-DEPENDS.html" target="_self"><code class="filename">DEPENDS</code></a>
through use of a
<code class="filename">[</code><a class="link" href="../bitbake-user-manual/variable-flags.html" target="_self"><code class="filename">deptask</code></a><code class="filename">]</code>
declaration, which guarantees that the required
shared-library/module-to-package mapping information will be available
when needed as long as <code class="filename">DEPENDS</code> has been
correctly set.
</p>
</div></body>
</html>