Compile a basic app against gstreamer at bitbake


I am triying to compile gstreamer helloworld example at bitbake. I didn’t want to add a Makefile for a basic app, so added compile directive to bitbake file like this:

DEPENDS_${PN} = "glibc-2.0 gstreamer1.0"

do_compile() {
  ${CXX} ${WORKDIR}/helloworld.cpp -o helloworld ${CXXFLAGS} ${LDFLAGS} `pkg-config --cflags --libs gstreamer1.0`

Giving bitbake gstreamer-examples gives this error:

| DEBUG: Executing shell function do_compile
| Package gstreamer1.0 was not found in the pkg-config search path.
| Perhaps you should add the directory containing `gstreamer1.0.pc'
| to the PKG_CONFIG_PATH environment variable
| No package 'gstreamer1.0' found
| /opt/yocto/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/gstreamer-examples/1.0.0-r0/helloworld.cpp:1:10: fatal error: gst/gst.h: No such file or directory
|  #include <gst/gst.h>
|           ^~~~~~~~~~~
| compilation terminated.

Than, tried to find why pkg-config can’t find at bitbake -c devshell gstreamer-examples:

$ pkg-config --list-all

There was no pacakges. Should gstreamer1.0 package be there ? Am I wrong with these line:

DEPENDS_${PN} = "glibc-2.0 gstreamer1.0"

You can get full recipie at here.

Note : I am at LinuxImageV2.8 bsp platform.


I think the pkg-config file gstreamer 1.0 provides is called gstreamer-1.0.pc. So you would miss a dash (’-’).

Did pkg-config reveal no gstreamer package at all, e.g. what is the output of:

$ pkg-config --list-all | grep gstreamer


I gave pkg-config --list-all output at devshell above. There are no packages listing.

This is the host side (Ubuntu 16.04) pacakges:

$ pkg-config --list-all | grep gstreamer
gstreamer-1.0                  GStreamer - Streaming media framework
gstreamer-net-1.0              GStreamer networking library - Network enabled GStreamer plug-ins and clocking
gstreamer-check-1.0            GStreamer check unit testing - Unit testing helper library for GStreamer modules
gstreamer-base-1.0             GStreamer base classes - Base classes for GStreamer elements
gstreamer-controller-1.0       GStreamer controller - Dynamic parameter control for GStreamer elements

Added ‘-’ to DEPENDS but no luck:

DEPENDS_${PN} = "glibc-2.0 gstreamer-1.0"

But adding RDEPENDS gives error that cannot find gstreamer-1.0 package:

RDEPENDS_${PN} = "gstreamer-1.0"

Also added ‘-’ to where I used, but no luck:

${CXX} ${WORKDIR}/helloworld.cpp -o helloworld ${CXXFLAGS} ${LDFLAGS} `pkg-config --cflags --libs gstreamer-1.0`


I tried it out and I found the following issues:

  • DEPENDS must not have a _${PN} suffix. Thus gstreamer1.0 is not been installed in the sysroot.
  • I guess you want a dependency on glib-2.0, not glibc (otherwise you would add glibc (not glibc-2.0) to DEPENDS)
  • The OE recipe and the resulting package for gstreamer 1.0 is called gstreamer1.0 which you put correctly, but the pkg-config file for gstreamer1.0 is called gstreamer-1.0.pc, so you must call pkg-config with gstreamer-1.0.

Note that the buildsystem adds RDEPENDS for all packages which are dynamically linked at build time. Only if you need additional packages which the build system can not automatically detect you need to specify them explicitly. For your example that would probably be the gstreamer plugins you use for your pipeline. This would only manifest itself when running your application and if those packages have not been added by some other means.

Thus my recipe looks now as follows:

    SUMMARY = "GStreamer examples"
    DESCRIPTION = "Gstreamer examples"
    SECTION = "examples"
    inherit pkgconfig
    DEPENDS = "glib-2.0 gstreamer1.0"
    RDEPENDS_${PN} = "gstreamer1.0-plugins-base gstreamer1.0-plugins-good"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    SRC_URI += " \
      file://. \
    inherit pkgconfig
    do_compile() {
      ${CXX} ${WORKDIR}/helloworld.cpp -o helloworld ${CXXFLAGS} ${LDFLAGS} `pkg-config --cflags --libs gstreamer-1.0`
    do_install() {
      install -d ${D}${bindir}/
      install -m 0755 ${S}/helloworld ${D}${bindir}/
    FILES_${PN} += " \
      ${bindir}/ \


Thanks Max. It builds now.