在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}

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

提前致谢。

我终于使它工作了,我要做的是使用makefile进行编译,使用配方,更重要的是添加inherit pkgconfig行,以便在编译过程中强制填充sysroot,这是最终的工作配方,希望它可以帮助遇到相同问题的其他人:

    #
    # 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"

    inherit pkgconfig 

    do_compile() {
             ${CC} ${WORKDIR}/myapp.c -o myapp ${CFLAGS} ${LDFLAGS} `pkg-config --cflags --libs gstreamer-1.0` 
    }

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章