[yocto] Yocto and Google protobuffer

Maciej Borzęcki maciej.borzecki at rndity.com
Fri Sep 2 01:37:48 PDT 2016


On Fri, Sep 2, 2016 at 10:08 AM, Pietro <pulsarpietro at posteo.net> wrote:
> Maciej Borzęcki
> <maciej.borzecki at rndity.com> writes:
>
>> On Thu, Sep 1, 2016 at 5:45 PM, Pietro <pulsarpietro at posteo.net> wrote:
>>> Herman van Hazendonk <me at herrie.org>
>>> writes:
>>>
>>>> If it takes the wrong version, it could be your layers aren't in the
>>>> right order. That's the first thing to check.
>>>>
>>>> You might want to try to run bitbake with
>>>>
>>>> -f protobuf -c cleanall or -f protobuf-native -c cleanall
>>>>
>>>> This will remove all locally ;)
>>>>
>>>> Then rebuild it... I haven't played much with the -native bits, so not
>>>> sure how those work.
>>>>
>>> I needed to specify DEPENDS = "protobuf-native" to get it working, I
>>> would be really interested to understand exactly what that does, but I
>>> must admit to myself I can't understand everything in a single shot.
>>
>> Quoting my first email:
>>>> All you need to do,
>>>>is include meta-oe in your layers (bblayers.conf) and have
>>>> protobuf-native listed in DEPENDS inside your package recipe.
>>
>> DEPENDS lists build time dependencies, like libraries, tools etc.
>> protobuf-native, by convention, means that the package was built for
>> your build host. This enables you to run protoc during the build to
>> generate proper language bindings.
>>
> Where are all these "native" binaries stored ? Is it "sysroot" ?
>
> How can I declare run-time dependencies ?

RDEPENDS, see https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-RDEPENDS

Libraries should be taken care of automatically (at least for ELF
binaries), so you will only need to list other services or packages
that are needed during runtime.

>
> Such library should be cross-compiled in order to successfully
> link my package's binaries against it, on the other hand when building
> the "protoc" the target should be the host machine as such tool will be
> run on the host machine when required.
>
> I wonder if is the "native" keyword in the DEPENDS statement to draw the
> line, so in a recipe A:
>
> i) DEPENDS = "protobuf"
>    tells that the recipe depends on the protobuf at run-time - namely during
>    the linking and when the binary resulting from A is executed.
>    So protobuf is cross-compiled.

So the protobuf recipe (meta-oe one) splits the package into 2 parts,
protobuf (libraries that are used by generated bindings) and
protobuf-compiler (one that generates bindings).
The build system will figure out that your package RDEPENDS on
protobuf (not protobuf-compiler).

The other package, protobuf-compiler, is not really needed in your
target filesystem, unless you want to generate bindings on the target
(as in on your ARM board or similar). It is generally a good practice
to spllt your packages so that the user does not have to pay the cost
for things they don't need.

>
> ii) DEPENDS = "protobuf-native"
>     tells that the recipe depends on the prottobuf at build-time and a
>     result of that protobuf is NOT cross compiled.

Yes. You need protoc to generate bindings at build time, hence you
need a version of protobuf that can be run by your native host (hence
-native).

-- 
Maciej Borzecki
RnDity



More information about the yocto mailing list