shared-librariesyoctorootfs

yocto project - missing dependencies in recipe-sysroot


As probably all yocto people know the sysrootfs policy changed in yocto rocko 2.4+. So I have the following issue: I try to make a recipe for a shared library with makefile. The recipe is below (I don't claim it is complete. I simply cannot pass building stage):

#==================
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${THISDIR}/files/LICENSE;md5=5959e502cb44bafc53b2cc9400e3d4cd"
PR = "r0"

##### First try from my local repo and then we will use the big one
SRC_URI = "git:///home/w23698/projects/anybus/Generic;branch=anybus-lib-0.0.1"
SRCREV = "2fe4ce39a651d71f3f8de1c751dff2581de2c526"

S = "${WORKDIR}/git"

PACKAGES = "${PN} ${PN}-dev ${PN}-dbg"
#####The only dependency 
RDEPENDS_${PN} = "libgpiod"
RDEPENDS_${PN}-dev = "libgpiod"
RDEPENDS_${PN}-dbg = "libgpiod"

do_compile() {
    oe_runmake
}

do_install() {
    install -d ${D}${libdir}
    install -m 0644 ${PN}-m40 ${D}${libdir}
}

What was my surprise when it failed with:

 ww.c:6:10: fatal error: gpiod.h: No such file or directory 
 |  #include "gpiod.h"
 |           ^~~~~~~~~
 | compilation terminated.

Then I noticed that the command line is:

arm-poky-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/<full path>/recipe-sysroot -L/usr/lib -g -Wall -fpic .....

I looked in recipe-sysroot/usr/lib/ and found a minimal set of libraries and libgpiod was not there. Neither the header was there in include...

Any suggestions?


Solution

  • You never set DEPENDS=libgpiod.

    The RDEPENDS you set are runtime depends so are not relevant for compile time. You can just remove those as the library linkage dependencies will be generated automatically.