Adding Boost recipe to Yocto SDK

2019-07-18 23:19发布

问题:

My goal is having a Yocto SDK with included boost libraries. Some of the libraries provided by Boost are header only but many others need to be compiled for my target architecture. I'm quite new to Yocto so I'm facing some difficulties. I had no problems defining a new layer for my webserver in bblayers.conf and appending packages in the local.conf for apache and php. I was quite lucky to have these packages already included in the yocto krogoth.

The problem rises with installing a new packet not present (or fetched) in the normal version, as it is for boost libraries. I found this resource on openembedded which explains that boost belongs to the openembedded-core layer and gives this recipe to add to the layer:

require boost-${PV}.inc
require boost.inc

SRC_URI += "\
    file://arm-intrinsics.patch \
    file://boost-CVE-2012-2677.patch \
    file://0001-boost-asio-detail-socket_types.hpp-fix-poll.h-includ.patch \
    file://boost-math-disable-pch-for-gcc.patch \
    file://0001-Apply-boost-1.62.0-no-forced-flags.patch.patch \
    file://0003-Don-t-set-up-arch-instruction-set-flags-we-do-that-o.patch \
    file://0002-Don-t-set-up-m32-m64-we-do-that-ourselves.patch \
    file://0001-correct-error-which-appeared-when-compiling-non-c-co.patch \
"

I'm quite unsure on how to use it. Should I download the boost libraries and unpack it in some directory ? Should I keep the tarball?

Reading some documentation this file expects some "file" resource, so something found on my local disk. Also, where should i place the bb recipe ? Is there a default folder ? From what I've read it doesn't really matter but is good practice to keep layers with layers, recipes with recipes and so on.

Then I should probably rebuild the image and finally perform a: bitbake -c populate_sdk

Could you possibly help me ?

回答1:

The default meta layer of yocto supplies version 1.63 of boost under recipes-support. As long as this layer is listed in the bblayers.conf you should be able to build boost 1.63 without extra work.

If a newer version is needed, you can create a boost-{version}.inc of your choosing and set the SRC_URI to your desired download. Though 1.63 should be sufficient for most usage.