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

Paul Eggleton paul.eggleton at linux.intel.com
Tue Sep 23 10:26:01 PDT 2014


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

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the yocto mailing list