<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>9679</bug_id>
          
          <creation_ts>2016-05-26 21:12:18 +0000</creation_ts>
          <short_desc>Add a small section on dependencies in the Writing a New Recipe section</short_desc>
          <delta_ts>2016-10-04 19:31:49 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>Development Manual</product>
          <component>development</component>
          <version>2.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>04 Oct 2016: RESOLVED</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Scott Rifenbark">srifenbark</assigned_to>
          <cc>jhaws</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Done (doc changes complete)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>62490</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-05-26 21:12:18 +0000</bug_when>
    <thetext>Add a small subsection on adding dependencies to the &quot;Writing a New Recipe&quot; section of the dev manual. At minimum this can cover the difference between build-time and runtime dependencies and the usage of DEPENDS and RDEPENDS respectively.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62491</commentid>
    <comment_count>1</comment_count>
    <who name="">jhaws</who>
    <bug_when>2016-05-26 22:01:53 +0000</bug_when>
    <thetext>Specifically, for my problem, how the suffix _${PN} applies to each one (or doesn&apos;t apply) would be helpful.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62742</commentid>
    <comment_count>2</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-06-08 01:21:06 +0000</bug_when>
    <thetext>Paul, 

Can you get me some explanation on this?  I will work from that for the new section.

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62743</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-06-08 01:21:39 +0000</bug_when>
    <thetext>Adding myself to the CC list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66293</commentid>
    <comment_count>4</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-09-18 21:19:26 +0000</bug_when>
    <thetext>OK, here&apos;s the raw material. This new subsection should go after the &quot;Licensing&quot; one.

---------- snip ----------

Dependencies

Most software packages have a short list of other packages that they require. These fall into two main categories - build-time dependencies (required when the software is built) and runtime dependencies (required to be installed on the target for the software to run).

Within a recipe, you specify build-time dependencies using the DEPENDS variable. There are some nuances, but for the most part items specified in DEPENDS should be names of other recipes. It is important to specify all build-time dependencies explicitly, otherwise due to the parallel nature of bitbake&apos;s execution you can end up with a race condition where the depency is present for one task of a recipe (e.g. do_configure) and then gone when the next task runs (e.g. do_compile). Another consideration is that configure scripts may automatically check for optional dependencies and enable corresponding functionality if they are found - this means that to ensure you get deterministic results (and avoid more race conditions) you need to either explicitly specify these dependencies as well, or tell the configure script explicitly to disable the functionality. If you wish to make a recipe that&apos;s more generally useful (particularly if you&apos;re going to publish the recipe in a layer for others to use), instead of hard-disabling the functionality you can use the PACKAGECONFIG variable to allow functionality and the corresponding dependencies to be enabled and disabled easily by other users of the recipe.

Likewise, runtime dependencies are specified through RDEPENDS - however, RDEPENDS is package-specific. All variables that are package-specific need to have the name of the package added to the end as an override. Since the main package for a recipe has the same name as the recipe, and the recipe&apos;s name can be found through the ${PN} variable, then you specify the dependencies for the main package by setting RDEPENDS_${PN}; if the package were named ${PN}-tools, then you would set RDEPENDS_${PN}-tools, and so on.

Some runtime dependencies will be set automatically at packaging time - these include any shared library dependencies i.e., if a package &quot;example&quot; contains &quot;libexample&quot; and another package &quot;mypackage&quot; contains a binary that links to &quot;libexample&quot; then the OpenEmbedded build system will automatically add a runtime dependency to &quot;mypackage&quot; on &quot;example&quot;. See &quot;Automatically Added Runtime Dependencies&quot; in the reference manual for further details.

---------- snip ----------</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66510</commentid>
    <comment_count>5</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-22 17:20:06 +0000</bug_when>
    <thetext>Paul, 

See http://www.yoctoproject.org/docs/2.2/dev-manual/dev-manual.html#new-dependencies for the new section.

Thanks,
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66871</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-10-04 16:11:29 +0000</bug_when>
    <thetext>Per separate email from Paul Eggleton, the changes here have been reviewed and approved.  I am setting the bug to RESOLVED and putting the doc flag to &quot;done.&quot;

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66888</commentid>
    <comment_count>7</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-10-04 19:31:49 +0000</bug_when>
    <thetext>Actually I&apos;d forgot to review that as well, but I just did now and it looks good.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>