<?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>11724</bug_id>
          
          <creation_ts>2017-06-27 12:59:27 +0000</creation_ts>
          <short_desc>bitbake core-image-minimal -c populate_sdk: -dev packages missing in SDK</short_desc>
          <delta_ts>2020-05-28 07:28:07 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>deployment</component>
          <version>2.3.2</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></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Berger">pokylinux</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>anders.darander</cc>
    
    <cc>bluelightning</cc>
    
    <cc>net147</cc>
    
    <cc>niko.mauno</cc>
    
    <cc>o.mandel</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>star</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>74571</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-06-27 12:59:27 +0000</bug_when>
    <thetext>I thought by bitbake core-image-minimal -c populate_sdk you automatically get all .h and .so files into the SDK. So you have an SDK which can build against a predefined software stack.

But [1] is not very clear about it when it says:&quot;When you build a standard SDK using the bitbake -c populate_sdk, a default set of packages is included in the resulting SDK.&quot;

It looks like those lib packages made it into the rootfs:

libblkid1 armv7a-neon 2.29.1-r0.0
libc6 armv7a-neon 2.25-r0.0
libkmod2 armv7a-neon 23+git0+65a885df5f-r0.0
libuuid1 armv7a-neon 2.29.1-r0.0
libz1 armv7a-neon 1.2.11-r0.0

but in the SDK I see those -dev packages:

libatomic-dev armv7a-neon 6.3.0-r0.0
libc6-dev armv7a-neon 2.25-r0.0
libgcc-s-dev armv7a-neon 6.3.0-r0.0
libssp-dev armv7a-neon 6.3.0-r0.0
libstdc++-dev armv7a-neon 6.3.0-r0.0
linux-libc-headers-dev armv7a-neon 4.9-r0.0

meaning I don&apos;t see e.g. a -dev package for libz automatically installed into the SDK.

I can add it with TOOLCHAIN_TARGET_TASK_append = &quot; zlib-dev&quot; but is this the desired behavior?

How would I get all the -dev packages into the SDK but not onto the rootfs?

[1] http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#sdk-adding-individual-packages</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74644</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2017-06-29 15:13:37 +0000</bug_when>
    <thetext>The intended work-flow here it to set &apos;dev-pkgs&apos; in the IMAGE_FEATURES then they will be included in the SDK. We&apos;ll need to confirm this so I&apos;ll do it unless someone gets to it before me. Thereafter, this defect will require a documentation update.

There&apos;s some concern about automatically adding all dev packages since for some users, just building say core-image-minimal, only a few dev-pkgs would be added and that is all that is needed and wanted.

There was some discussion about teaching bitbake that if an image ends in -dev then the IMAGE_FEATURES variable would be automatically updated but people were not happy with such magic. In addition, we discussed manually defining a FOO-dev for all FOO images, but users already have too many image choices so a documentation solution is preferred.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74786</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-07-05 16:13:33 +0000</bug_when>
    <thetext>Just to clarify that I understood what you are saying.

You are saying that the proposed workflow is to to include dev-pkgs in the image features.

My understanding is, that like this all dev packages will be installed in the image as well (like with -sdk images when you want to compile on the target). The docu says:&quot;dev-pkgs: Installs development packages (headers and extra library links) for all packages installed in a given image.&quot; 

Is this the case?

I am not sure that is what I would want;) And I am pretty sure most developers will agree with me;)

I would like some image without headers and if I create an SDK e.g. via do_populate_sdk I would like to find everything needed to build against what&apos;s in the image (including headers and libs) in the SDK.

&quot;The do_populate_sdk task helps create the standard SDK and handles two parts: a target part and a host part. The target part is the part built for the target hardware and includes libraries and headers. The host part is the part of the SDK that runs on the SDKMACHINE.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76025</commentid>
    <comment_count>3</comment_count>
    <who name="Arno Steffens">star</who>
    <bug_when>2017-08-21 09:56:32 +0000</bug_when>
    <thetext>Is there any news to this? I would agree to Robert.
The expectation of a &quot;-c populate_sdk&quot; is the inclusion of the headers to uses it for development. Why else I do need an SDK? 

Otherwise (which would be pity) I would like to know, what to do to just add the dev packages to the SDK and not to the image ?

Do I have do add all dev packages I need manually or is there a general include?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76035</commentid>
    <comment_count>4</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-08-21 20:43:10 +0000</bug_when>
    <thetext>Contrary to what Randy said above, if you build an SDK you should get all -dev packages in the SDK corresponding to the normal packages in the image, that&apos;s been the design for a very long time. I can&apos;t immediately explain what you are seeing, but it does need to be investigated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76041</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2017-08-22 01:11:49 +0000</bug_when>
    <thetext>Thanks for clearing that up Paul. I don&apos;t often use the SDK and I was trying to document what I had heard from someone else on the bugboard call. Sorry for causing any confusion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76413</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2017-08-31 15:42:46 +0000</bug_when>
    <thetext>Chen Qi is going to check on this for Mark.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76434</commentid>
    <comment_count>7</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2017-09-01 06:12:52 +0000</bug_when>
    <thetext>I&apos;ve tested `bitbake core-image-minimal -c populate_sdk&apos;, and both *-dev packages and *-dbg packages are installed correctly, including libz-dev and libz-dbg.

Some related codes are as below.

  meta/classes/populate_sdk_base.bbclass:SDKIMAGE_FEATURES ??= &quot;dev-pkgs dbg-pkgs ${@bb.utils.contains(&apos;DISTRO_FEATURES&apos;, &apos;api-documentation&apos;, &apos;doc-pkgs&apos;, &apos;&apos;, d)}&quot;

  meta/classes/populate_sdk_base.bbclass:SDKIMAGE_INSTALL_COMPLEMENTARY = &apos;${@complementary_globs(&quot;SDKIMAGE_FEATURES&quot;, d)}&apos;

  meta/lib/oe/sdk.py:        self.target_pm.install_complementary(self.d.getVar(&apos;SDKIMAGE_INSTALL_COMPLEMENTARY&apos;))


So as long as the user doesn&apos;t override SDKIMAGE_FEATURES, the dev and dbg packages would be installed automatically.

Robert, could you please help check if the setting for your SDKIMAGE_FEATURES is correct. Also, you could check if SDKIMAGE_INSTALL_COMPLEMENTARY is set correctly by `bitbake &lt;image_recipe&gt; -c populate_sdk -e &gt; env&apos; and checking the file.
If they are both set correctly, and you still have this problem, you could follow the install_complementary function and debug a little.
Hope to hear some feedback from you.

Regards,
Chen Qi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76781</commentid>
    <comment_count>8</comment_count>
    <who name="Olaf Mandel">o.mandel</who>
    <bug_when>2017-09-13 11:55:36 +0000</bug_when>
    <thetext>Here is a minimal test-layer consisting of only 7 files that shows the problem. After running &quot;bitbake -c populate_sdk test-image&quot; one expectes the file usr/lib/test-lib to be present in the SDK (which it isn&apos;t):


# meta-test/conf/bblayers.conf.sample
LCONF_VERSION = &quot;7&quot;
BBLAYERS ?= &quot; \
  ##OEROOT##/meta \
  ##OEROOT##/meta-test \
  &quot;

# meta-test/conf/layer.conf
BBPATH .= &quot;:${LAYERDIR}&quot;
BBFILES += &quot;${LAYERDIR}/recipes-core/*/*.bb&quot;
BBFILE_COLLECTIONS += &quot;test&quot;
BBFILE_PATTERN_test = &quot;^${LAYERDIR}/&quot;
BBFILE_PRIORITY_test = &quot;7&quot;
LAYERDEPENDS_test = &quot;core&quot;

# meta-test/conf/local.conf.sample
CONF_VERSION = &quot;1&quot;
MACHINE = &quot;qemux86-64&quot;

# meta-test/recipes-core/images/test-image.bb
inherit core-image
IMAGE_INSTALL = &quot;test-app&quot;

# recipes-core/test-app/files/configure
#!/bin/sh
if [ -f &quot;${PKG_CONFIG_SYSROOT_DIR:-}${libdir:-/usr/lib}/test-lib&quot; ]; then
  echo &quot;test-lib found.&quot;
else
  echo &gt;&amp;2 &quot;test-lib not found!&quot;
  exit 1
fi

# meta-test/recipes-core/test-app/test-app.bb
LICENSE = &quot;PD&quot;
LIC_FILES_CHKSUM =
&quot;file://${COREBASE}/meta/files/common-licenses/PD;md5=b3597d12946881e13cb3b548d1173851&quot;
DEPENDS = &quot;test-lib&quot;
SRC_URI = &quot;file://configure;subdir=${BPN}-${PV}&quot;
do_configure () {
    sh configure
}

# meta-test/recipes-core/test-lib/test-lib.bb
LICENSE = &quot;PD&quot;
do_install () {
    install -d &quot;${D}${libdir}&quot;
    touch &quot;${D}${libdir}/test-lib&quot;
}
FILES_${PN} = &quot;${libdir}/test-lib&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76782</commentid>
    <comment_count>9</comment_count>
    <who name="Olaf Mandel">o.mandel</who>
    <bug_when>2017-09-13 12:03:30 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; # recipes-core/test-app/files/configure

Oops: forgot the directory for the layer in there. The file is under:

# meta-test/recipes-core/test-app/files/configure</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77521</commentid>
    <comment_count>10</comment_count>
    <who name="Olaf Mandel">o.mandel</who>
    <bug_when>2017-10-11 16:07:14 +0000</bug_when>
    <thetext>Found a problem with my test-layer: test-app.bb installs no files and thus does not produce a package. This is the reason why the SDK does not contain test-lib. So adding a minimal do_install() to test-app.bb makes the SDK for the test-layer work.

But this shows the path to the original problem of this ticket: the SDK population works package-based, not recipe-based. So if an image contains an empty application-package, then the SDK will not contain any library packages mentioned in the application recipe. Likewise, if any of the libraries mentioned in a recipes DEPENDS variable generates an empty package (think: header-only libraries), then the matching lib-dev package will be missing from the SDK. This can be shown in the test-layer by modifying it a bit (see below). Without the ALLOW_EMPTY line, the SDK will be missing test-lib.h, with the line the file will be present.

Finally, the original problem of libz-dev missing is also related: the applications in the image depend on the libz1 package, but there is no libz1-dev package; it is called libz-dev, instead. Similar problems seem to exist for all library packages that get their major version number added to their package name.

As of this moment, I have no idea how to solve these problems in general. One can go ahead and add PACKAGES += &quot;${PN}&quot; and ALLOW_EMPTY_${PN} = &quot;1&quot; to all header-only library recipes (e.g. cppzmq_git). But that seems hacky, and it does not help with the package-name discrepancy. Any idea where the renaming happens?



# meta-test/recipes-core/test-app/files/configure
#!/bin/sh
if [ -f &quot;${PKG_CONFIG_SYSROOT_DIR:-}${includedir:-/usr/include}/test-lib.h&quot; ];
then
  echo &quot;test-lib found.&quot;
else
  echo &gt;&amp;2 &quot;test-lib not found!&quot;
  exit 1
fi

# meta-test/recipes-core/test-lib/test-lib.bb
LICENSE = &quot;PD&quot;
do_install () {
    install -d &quot;${D}${includedir}&quot;
    touch &quot;${D}${includedir}/test-lib.h&quot;
}
#ALLOW_EMPTY_${PN} = &quot;1&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77948</commentid>
    <comment_count>11</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2017-11-03 16:45:37 +0000</bug_when>
    <thetext>I built with my pre 2.4 release and it shows a similar behaviour as I reported before. 

Maybe I need to clarify things a bit more and give some more examples:

libz is part of core-image-sato-sdk

since it&apos;s a xxx-sdk I can see on the rootfs:

./core-image-sato-sdk-multi-v7-ml/usr/include/zlib.h

and also I can see on the sysroot:

./sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/zlib.h

I believe if I build a core-image-minimal (without the sdk) which contains the zlib and then 

core-image-minimal -c populate_sdk

./sysroots/armv7a-neon-poky-linux-gnueabi/usr/include/zlib.h

is missing. (Need to re-test this to be 100% sure).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79628</commentid>
    <comment_count>12</comment_count>
    <who name="Niko Mauno">niko.mauno</who>
    <bug_when>2018-02-28 16:28:42 +0000</bug_when>
    <thetext>Hi, just in case somebody might find this helpful - I believe I encountered somewhat similar issue, and submitted a patch to make the underlying failure more explicit to bitbake user: http://lists.openembedded.org/pipermail/openembedded-core/2018-February/147966.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80089</commentid>
    <comment_count>13</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-04-04 06:22:11 +0000</bug_when>
    <thetext>Just for completeness the oe-patchwork link of Niko Mauno&apos;s patch:

https://patches.openembedded.org/patch/149321/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80846</commentid>
    <comment_count>14</comment_count>
    <who name="Robert Berger">pokylinux</who>
    <bug_when>2018-06-20 11:54:58 +0000</bug_when>
    <thetext>looks like the patch, or something similar made it into Sumo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87347</commentid>
    <comment_count>15</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-05-28 07:28:07 +0000</bug_when>
    <thetext>As above, fixes were merged for this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>