[yocto] How to include static library and headers in sdk

Matt Schuckmann Matt.Schuckmann at planar.com
Tue Sep 23 10:57:21 PDT 2014



> -----Original Message-----
> From: Paul Eggleton [mailto:paul.eggleton at linux.intel.com]
> Sent: Tuesday, September 23, 2014 10:26 AM
> To: Matt Schuckmann
> Cc: yocto at yoctoproject.org
> Subject: Re: [yocto] How to include static library and headers in sdk
> 
> On Tuesday 23 September 2014 10:21:44 Matt Schuckmann wrote:
> > > -----Original Message-----
> > > From: Paul Eggleton [mailto:paul.eggleton at linux.intel.com]
> > > Sent: Tuesday, September 23, 2014 9:54 AM
> > > To: Matt Schuckmann
> > > Cc: yocto at yoctoproject.org
> > > Subject: Re: [yocto] How to include static library and headers in
> > > sdk
> > >
> > > On Tuesday 23 September 2014 09:43:55 Matt Schuckmann wrote:
> > > > > -----Original Message-----
> > > > > From: Paul Eggleton [mailto:paul.eggleton at linux.intel.com]
> > > > > Sent: Tuesday, September 23, 2014 2:10 AM
> > > > > To: Matt Schuckmann
> > > > > Cc: yocto at yoctoproject.org
> > > > > Subject: Re: [yocto] How to include static library and headers
> > > > > in sdk
> > > > >
> > > > > On Monday 22 September 2014 18:57:03 Matt Schuckmann wrote:
> > > > > > I've got a custom image and 2 custom recipes both very simple
> > > > > > libraries that use cmake. I included the libraries into my
> > > > > > image by adding EXTRA_IMAGEDEPENDS += "simple1"
> > > > > > EXTRA_IMAGEDEPENDS += "simple2"
> > > > > > To my image recipe.
> > > > >
> > > > > Except this doesn't actually add those things into your image,
> > > > > it only ensures they are built alongside it. To actually add
> > > > > them to the image
> > > >
> > > > > you need to ensure you add them to IMAGE_INSTALL; see:
> > > > If I add my simple1 and simple2 recipes to IMAGE_INSTALL I get
> the
> > > > following error in the do_rootfs task: * opkg_install_cmd: Cannot
> > > > install package simple1.
> > > >
> > > > I assumed that this is because there really is nothing to install
> > > > in the image as this is a static library with nothing that should
> > > > go in
> > >
> > > the image.
> > >
> > > > > http://www.yoctoproject.org/docs/current/dev-manual/dev-> >
> > > > > manual.html#usingpoky-extend-customimage
> > > > >
> > > > > > When I build my image (i.e. bitbake custom-image ) I can see
> > > > > > that the library header files and .a files are placed in the
> > > > > > correct place in the sysroot directory.
> > > > > >
> > > > > > However when I try to create an sdk (i.e. bitbake custom-
> image
> > > > > > -c
> > > > > > populate_sdk) and then install the SDK the headers and .a
> > > > > > files are nowhere to be found in the installed sysroot.
> > > > >
> > > > > If you want all -staticdev packages in the SDK for the
> libraries
> > > > > in your image, add the following to your local.conf (or the
> > > > > image recipe,
> > > > >
> > > > > doesn't matter which):
> > > > >  SDKIMAGE_FEATURES = "dev-pkgs dbg-pkgs staticdev-pkgs"
> > > > >
> > > > > If you want a single staticdev package in the SDK you'd need to
> > > > > add the
> > > > >
> > > > > following instead:
> > > > >  TOOLCHAIN_HOST_TASK_append = " simple1-staticdev"
> > > >
> > > > Again if I try adding this to my image recipe I get a similar
> > > > error
> > > > * opkg_install_cmd: Cannot install package simple1-staticdev.
> > > >
> > > > For reference here is my simple1 recipe, maybe I'm missing
> > > > something in there.
> > > >
> > > > DESCRIPTION = "Simple library 1."
> > > > LICENSE = "CLOSED"
> > > > LIC_FILES_CHKSUM = ""
> > > >
> > > > SRC_URI =
> "git://git@gitlab.work.net/libs/simple1.git;protocol=ssh"
> > > > SRCREV = "${AUTOREV}"
> > > >
> > > > S = "${WORKDIR}/git"
> > > >
> > > > inherit pkgconfig cmake
> > >
> > > So is your recipe actually producing any packages at all? i.e. are
> > > any of the directories under packages-split within the workdir for
> > > the recipe non-empty?
> > > At the moment it looks like it isn't producing anything.
> >
> > Yes the simple1-dev directory contains the include files and the
> > library file under usr/include and usr/lib respectively. The
> > simple1-staticdev directory contains only the library file under
> usr/lib.
> >
> > My understanding, limited as it is, is that the cmake class handles
> > identifying what goes in what package automagicaly assuming some
> basic
> > conventions about where things get installed. Note if I run: bitbake
> > -e
> > simple1
> > and search for FILES_simple1-staticdev I find:
> > # $FILES_simple1-staticdev
> > #   rename from FILES_${PN}-staticdev data.py:170 [expandKeys]
> > FILES_simple1-staticdev="/usr/lib/*.a /lib/*.a /usr/lib/simple1/*.a"
> >
> > Or search for FILES_simple1-dev
> > #
> > # $FILES_simple1-dev
> > #   rename from FILES_${PN}-dev data.py:170 [expandKeys]
> > #     "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la ${libdir}/*.o
> > ${libdir}/pkgconfig ${datadir}/pkgconfig ${datadir}/aclocal
> > ${base_libdir}/*.o ${libdir}/${BPN}/*.la ${base_libdir}/*.la"
> > FILES_jsoncpp-dev="/usr/include /lib/lib*.so /usr/lib/lib*.so
> > /usr/lib/*.la /usr/lib/*.o /usr/lib/pkgconfig /usr/share/pkgconfig
> > /usr/share/aclocal /lib/*.o /usr/lib/simple1/*.la /lib/*.la"
> >
> > If my understanding is wrong then that's totally understandable as
> I'm
> > new to this as there really isn't much of any documentation on how
> the
> > cmake class works.
> 
> That sounds correct to me.
> 
> Actually I realised I made a mistake above that might explain why the
> second suggestion didn't work as expected. I think you need to add to
> TOOLCHAIN_TARGET_TASK rather than TOOLCHAIN_HOST_TASK i.e.:
> 
>  TOOLCHAIN_TARGET_TASK_append = " simple1-staticdev"
> 
> Try that and see if it works.
> 
> Cheers,
> Paul
> 

Ya I noticed that it might need to be TOOLCHAIN_TARGET_TASK instead of TOOLCHAIN_HOST_TASK. 
When I try that I get almost the same error, now it's:
* satisfy_dependencies_for: Cannot satisfy the following dependencies for simple1-dev:
* 	simple1 (= 0.7.0-r0) * 
* opkg_install_cmd: Cannot install package simple1-dev.

Notice that my simple1 recipe file is called simple1_0.7.0.bb, I don't know what dependency it can't resolve.

If I open up the simple-dev_0.7.0-r0_cortexa8t2hf-vfp-neon.ipk file and inspect the control file I can see a Depends line like so: 
Depends: simple1 (= 0.7.0-r0)

I'm not sure if this has anything to do with it. 

Many thanks for your continued help. 
Matt S. 



More information about the yocto mailing list