cmakegstreameryoctoyocto-recipe

No such file or directory when Integrating my cmakelists package in yocto project


I can successfully compile and run this gstreamer plugin using CMakeLists on ubuntu 22.04: LINK

Now, I'm trying to integrate this package in my Yocto project. So I wrote this bb recipe:

SUMMARY = "Test" 
LICENSE = "CLOSED" 
SECTION = "support"

PACKAGE_ARCH = "${MACHINE_ARCH}"

PV = "${MY_VERSION}"
PR = "${MY_REVISION}"

FILESEXTRAPATHS:prepend := "${MY_SOURCE_DIR}:"

SRC_URI = " \
    file://image-processing/CMakeLists.txt \
    file://image-processing/main.cpp \
    file://image-processing/gst_opencv_call_plugin.cpp \
"

S = "${WORKDIR}/image-processing"

DEPENDS += " \
    pkgconfig \
    gstreamer1.0 \
    gstreamer1.0-plugins-bad \
    opencv \
    glib-2.0 \
    pcre \
    libffi \
    zlib \
"

inherit cmake pkgconfig

CMAKE_INSTALL_DIR = "/usr/lib/gstreamer-1.0"
CXXFLAGS += "-I${S}/gst-libs"

FILES_${PN} += "${CMAKE_INSTALL_DIR}/libcvimageprocessing.so"

do_install() {
    install -d ${D}${CMAKE_INSTALL_DIR}
    install -m 0755 ${B}/libcvimageprocessing.so ${D}${CMAKE_INSTALL_DIR}/
}

FILES_${PN}-dbg += "${CMAKE_INSTALL_DIR}/.debug/"

FILES_${PN}-dev += "${CMAKE_INSTALL_DIR}/libcvimageprocessing.so"

RDEPENDS:${PN} += "\
    gstreamer1.0-plugins-bad-dtls \
    gstreamer1.0-plugins-bad-shm \
    gstreamer1.0-plugins-bad-srtp \
    gstreamer1.0-plugins-bad-videoparsersbad \
    gstreamer1.0-plugins-bad-opusparse \
    gstreamer1.0-plugins-bad-webrtc \
    gstreamer1.0-plugins-bad-webrtcdsp \
    gstreamer1.0-plugins-bad-opencv \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-good-alpha \
    gstreamer1.0-plugins-good-autodetect \
    gstreamer1.0-plugins-good-isomp4 \
    gstreamer1.0-plugins-good-multifile \
    gstreamer1.0-plugins-good-png \
    gstreamer1.0-plugins-good-pulseaudio \
    gstreamer1.0-plugins-good-rtp \
    gstreamer1.0-plugins-good-rtpmanager \
    gstreamer1.0-plugins-good-rtsp \
    gstreamer1.0-plugins-good-udp \
    libnice \
    "

But I get this error when building the project using bitbake:

gst_opencv_call_plugin.cpp:5:10: fatal error: gst/opencv/gstopencvvideofilter.h: No such file or directory
|     5 | #include <gst/opencv/gstopencvvideofilter.h>
|       |          ^~~~~~~~

I looked for that file and I found it in this path:

poky/build/tmp/work/cortexa53-oclea-linux/gstreamer1.0-plugins-bad/1.18.6-r1/gst-plugins-bad-1.18.6/gst-libs/gst/opencv

It means that the package gst-plugins-bad has been built by bitbake.

Is the problem related to my bb recipe or my CMakeLists?


Solution

  • I solved the error by appending opencv in a gstreamer1.0-plugins-bad_1.%.bbappend:

    PACKAGECONFIG:append = " opencv"
    

    And also increased the maximum version required by gstreamer1.0-plugins-bad in their meson.build file, as it was limited to an old version:

    opencv_dep = dependency('opencv4', version : ['>= 4.0.0', '< 4.8.0'], required : false)