Yocto [tdx-reference-multimedia-image], how to include header files from packages like dbus

Hi Team,

We are using tdx-reference-multimedia-image for Apalis iMX8 and Yocto Project dunfell to build this image.

My program recipe depends on the “dbus” packages, which provides both the header files and shared libraries. However, I cannot make use of the header files from “dbus” in my recipe, which leads to the error : fatal error: dbus/dbus.h: No such file or directory #include <dbus/dbus.h>

How do I make the header available at build time for my recipe package?.

In my recipe file added DEPENDS as follows.

DEPENDS = “dbus dbus-glib”

At recipe compile time unable to find the header from DEPENDS package “dbus”

Please provide any of your input…

Regards,
Deepak Jewarg

Hi @djewargi ,

Thanks for posting query to Toradex Community.
To understand and find out reason for issue, can you please share complete recipe to check. Ideally if you have below in recipe it should be able to compile taht said we can comment better if we know what exactly you are doing in recipe.

DEPENDS = "dbus dbus-glib"
inherit pkgconfig
EXTRA_OEMAKE += "'CFLAGS=${CFLAGS} -I${WORKDIR}'"

Best Regards
Ritesh Kumar

Thanks Ritesh,

It didn’t work after addition DEPENDS
DEPENDS = “dbus dbus-glib”
inherit pkgconfig
EXTRA_OEMAKE += “‘CFLAGS=${CFLAGS} -I${WORKDIR}’”

Please find complete recipe and error’s in the below screenshot

Hi @djewargi,

Thanks for sharing detail, unfortunately it will be difficult to test your recipe since we do not have exact setup and recipe, that said we tried building simple dbus example and this is working good.
Please check below recipe what we tested

build@build-MS-7C37:~/oe-core-5/build$ cat ../layers/meta-custom/recipes-custom/dbus-demo/dbus-demo_1.0.0.bb 
SUMMARY = "My D-Bus Application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"


SRC_URI = "file://dbus-demo.c"

# Set LDFLAGS options provided by the build system
TARGET_CC_ARCH += "${LDFLAGS}"

DEPENDS = "dbus"

S = "${WORKDIR}"

inherit pkgconfig

EXTRA_OEMAKE += "'CFLAGS=${CFLAGS} -I${STAGING_INCDIR}'"

do_compile() {
    ${CC} ${LDFLAGS} ${CFLAGS} -o ${B}/dbus-demo dbus-demo.c `pkg-config --cflags --libs dbus-1`
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 ${S}/dbus-demo ${D}${bindir}
}

FILES_${PN} += "${bindir}/dbus-demo"

Directory

../layers/meta-custom/recipes-custom/
└── dbus-demo
    ├── dbus-demo
    │   └── dbus-demo.c
    └── dbus-demo_1.0.0.bb

Best Regards
Ritesh Kumar