首页 > 解决方案 > 在 petalinux 中编译 gstreamer 应用程序时出错

问题描述

我正在尝试使用以下头文件在 petalinux 中编译自定义 gstreamer 应用程序:

#include <stdlib.h>
#include <string.h>
#include <gst/gst.h>
#include <gio/gio.h>

petalinux 项目在运行后已经填充了 sysroot 库源:

petalinux-build --sdk
petalinux-package --sysroot

但是编译应用程序(petalinux-build -c myapp)我得到了下一个错误:

| myapp.c:25:10: fatal error: gst/gst.h: No such file or directory
|  #include <gst/gst.h>
|           ^~~~~~~~~~~
| compilation terminated.

制作文件是:

APP = myapp

# Add any other object files to this list below
APP_OBJS = myapp.o

all: build

build: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    -rm -f $(APP) *.elf *.gdb *.o

%.o : %.c
    $(CC) -c $(CFLAGS) -o $@ $< $(shell pkg-config --cflags --libs gstreamer-1.0 glib-2.0)

和食谱:

#
# This file is the myapp recipe.
#

SUMMARY = "Simple myapp application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://myapp .c \
       file://Makefile \
          "

S = "${WORKDIR}"

do_compile() {
         oe_runmake
}

do_install() {
         install -d ${D}${bindir}
         install -m 0755 myapp ${D}${bindir}

有谁知道我缺少什么以及如何正确添加 gstreamer 路径以进行编译?

编辑

正如建议的那样,我在配方中添加了 DEPENDS 行:

#
# This file is the myapp recipe.
#

SUMMARY = "Simple myapp application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://myapp .c \
       file://Makefile \
          "

S = "${WORKDIR}"

DEPENDS = "glib-2.0 gstreamer1.0"
RDEPENDS_${PN} = "gstreamer1.0-plugins-base gstreamer1.0-plugins-good"

do_compile() {
         oe_runmake
}

do_install() {
         install -d ${D}${bindir}
         install -m 0755 myapp ${D}${bindir}

但不幸的是仍然给出同样的错误......任何想法可能是错误/遗漏?

提前致谢。

标签: gstreamerpetalinux

解决方案


我认为您缺少指向编译代码所需的 GStreamer 包的 DEPENDS。将它们放在图像中不足以构建此配方。

您可以查看构建 GStreamer 的 RTSP 服务器的配方(http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.1。 bb?h=master )

DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base"


推荐阅读