From 8bc6c1c2c817fdc4ee12e165489aab6885fa9e9c Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Tue, 13 Sep 2016 11:15:02 -0700 Subject: ref-manual: New section and updates for runtime dep work fixes [YOCTO #10248] The bulk of this change is a new section called "Automatically Added Runtime Dependencies". Additionally, changes were made to the RDEPENDS and DEPENDS variables. Some cross-referencing to the new material was also added in the do_package task entry, the do_packagedata task entry, the PKGDATA_DIR glossary entry, and the PRIVATE_LIBS glossary entry. (From yocto-docs rev: 16504cd0eb23e102322c6c6096c5b52500a04640) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/ref-manual/ref-tasks.xml | 13 +++ documentation/ref-manual/ref-variables.xml | 146 +++++++++++++------------ documentation/ref-manual/technical-details.xml | 107 ++++++++++++++++++ 3 files changed, 196 insertions(+), 70 deletions(-) (limited to 'documentation') diff --git a/documentation/ref-manual/ref-tasks.xml b/documentation/ref-manual/ref-tasks.xml index b0a65a989b..fa9fca1ce3 100644 --- a/documentation/ref-manual/ref-tasks.xml +++ b/documentation/ref-manual/ref-tasks.xml @@ -334,6 +334,17 @@ FILES variables. + + + The do_package task, in conjunction with the + do_packagedata + task, also saves some important package metadata. + For additional information, see the + PKGDESTWORK + variable and the + "Automatically Added Runtime Dependencies" + section. +
@@ -408,6 +419,8 @@ Creates package metadata used by the build system to generate the final packages. + The data is saved in + PKGDATA_DIR.
diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml index afc36a5b14..188cd74935 100644 --- a/documentation/ref-manual/ref-variables.xml +++ b/documentation/ref-manual/ref-variables.xml @@ -2833,9 +2833,9 @@ add any runtime dependencies between the packages produced by the two recipes. However, as explained in the - RDEPENDS - glossary entry, runtime dependencies will often - be added automatically, meaning + "Automatically Added Runtime Dependencies" + section, runtime dependencies will often be + added automatically, meaning DEPENDS alone is sufficient for most recipes. @@ -9651,14 +9651,16 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" do_packagedata task packages data for each recipe and installs it into this temporary, shared area. - This directory defaults to the following: + This directory defaults to the following, which you should + not change: ${STAGING_DIR_HOST}/pkgdata - - - - Do not change this default. + For examples of how this data is used, see the + "Automatically Added Runtime Dependencies" + section and the + "Viewing Package Information with oe-pkgdata-util" + section. @@ -10133,6 +10135,12 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" libplds4.so" + + + For more information, see the + "Automatically Added Runtime Dependencies" + section. + @@ -10427,40 +10435,60 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" RDEPENDS - RDEPENDS[doc] = "Lists a package's runtime dependencies (i.e. other packages) that must be installed for the package to be built. They must be the names of other packages as listed in the PACKAGES variable, not recipe names (PN)." + RDEPENDS[doc] = "Lists runtime dependencies of a package." - Lists a package's runtime dependencies (i.e. other packages) - that must be installed in order for the built package to run - correctly. - If a package in this list cannot be found during the build, - you will get a build error. + Lists runtime dependencies of a package. + These dependencies are other packages that must be + installed in order for the package to function correctly. + As an example, the following assignment declares that the + package foo needs the packages + bar and baz to + be installed: + + RDEPENDS_foo = "bar baz" + + The most common types of package runtime dependencies are + automatically detected and added. + Therefore, most recipes do not need to set + RDEPENDS. + For more information, see the + "Automatically Added Runtime Dependencies" + section. + + + + The practical effect of the above + RDEPENDS assignment is that + bar and baz + will be declared as dependencies inside the package + foo when it is written out by one of + the + do_package_write_* + tasks. + Exactly how this is done depends on the package format used + as described in the + PACKAGE_CLASSES + variable. + When the corresponding package manager installs the + package, it will know to also install the packages on + which it depends. - When you use the RDEPENDS variable - in a recipe, you are essentially stating that the recipe's + To ensure that the packages bar and + baz get built, the previous + RDEPENDS assignment also causes a task + dependency to be added. + This dependency is from the recipe's do_build - task depends on the existence of a specific package. - Consider this simple example for two recipes named "a" and - "b" that produce similarly named IPK packages. - In this example, the RDEPENDS - statement appears in the "a" recipe: - - RDEPENDS_${PN} = "b" - - Here, the dependency is such that the - do_build task for recipe "a" depends - on the - do_package_write_ipk - task of recipe "b". - This means the package file for "b" must be available when - the output for recipe "a" has been completely built. - More importantly, package "a" will be marked as depending - on package "b" in a manner that is understood by the - package manager. + (not to be confused with the + do_compile) + task to the to the do_package_write_* + task of the recipes that build bar and + baz. @@ -10480,7 +10508,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" Because the RDEPENDS variable applies to packages being built, you should always use the variable - in a form with an attached package name. + in a form with an attached package name (remember that a + single recipe can build multiple packages). For example, suppose you are building a development package that depends on the perl package. In this case, you would use the following @@ -10508,41 +10537,18 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" - The package name you attach to the - RDEPENDS variable must appear - as it would in the PACKAGES - namespace before any renaming of the output package by - classes like - debian. - - - - In many cases you do not need to explicitly add - runtime dependencies using - RDEPENDS since some automatic - handling occurs: - - shlibdeps: - If a runtime package contains a compiled binary, - the build processes the binary in order to - determine any shared libraries - (.so files) to which it is - dynamically linked. - The build process adds the packages containing - these libraries to RDEPENDS - when creating the runtime package. - In addition, if the shared library is versioned, - the dependency will have the version appended to it - in order to force an upgrade to the appropriate - version if needed. - - pcdeps: If - the package ships a pkg-config - information file, the build process uses this file - to add items to the RDEPENDS - variable to create the runtime packages. - - + The package names you use with + RDEPENDS must appear as they would in + the PACKAGES variable. + The + PKG + variable allows a different name to be used for + the final package (e.g. the + debian + class uses this to rename packages), but this final package + name cannot be used with RDEPENDS, + which makes sense as RDEPENDS is meant + to be independent of the package format used. diff --git a/documentation/ref-manual/technical-details.xml b/documentation/ref-manual/technical-details.xml index 6bad547e50..e5c8eb83b6 100644 --- a/documentation/ref-manual/technical-details.xml +++ b/documentation/ref-manual/technical-details.xml @@ -979,6 +979,113 @@ +
+ Automatically Added Runtime Dependencies + + + The OpenEmbedded build system automatically adds common types of + runtime dependencies between packages, which means you do not need to + explicitly declare the packages using + RDEPENDS. + Two automatic mechanisms exist (shlibdeps and + pcdeps) that handle shared libraries and + package configuration (pkg-config) modules, respectively. + For other types of runtime dependencies, you must manually declare + the dependencies. + + + shlibdeps: + During the + do_package + 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 + soname + of the library. + The resulting shared-library-to-package mapping + is saved globally in + PKGDATA_DIR + by the + do_packagedata + task. + + 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, + PKGDATA_DIR 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. + + If the library being linked against is versioned + (i.e. includes a version number), then the automatically added + runtime dependency will specify at least that version, as if + "package (>= version)" + had been added to + RDEPENDS. + This dependency forces an upgrade of the package that provides + the shared library when installing the package that depends on + the library, if needed. + + 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 + PRIVATE_LIBS + inside the package's recipe. + + + pcdeps: + During the + do_package + task of each recipe, all pkg-config modules + (*.pc 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 + PKGDATA_DIR + by the + do_packagedata + task. + + Simultaneously, all pkg-config modules installed by the + recipe are inspected to see what other modules on which the + pkg-config modules depend. + A module is seen as depending on another module if it contains + a "Requires:" line that specifies the other module. + For each module dependency, + PKGDATA_DIR 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. + + The pcdeps mechanism most often infers + dependencies between -dev packages. + + + + + + + The do_package task depends on the + do_packagedata + task of each recipe in + DEPENDS + through use of a + [vardeps] + declaration, which guarantees that the required + shared-library/module-to-package mapping information will be available + when needed as long as DEPENDS has been + correctly set. + +
+
Fakeroot and Pseudo -- cgit v1.2.3-54-g00ecf