我正在尝试使用下一个头文件在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.
make文件是:
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}
但是不幸的是,仍然出现相同的错误...任何想法可能是错误的/遗漏的?
谢谢。
答案 0 :(得分:0)
我认为您缺少DEPENDS,该DEPENDS指向编译代码所需的GStreamer软件包。在图像上仅具有它们不足以构建此配方。
您可以看一下构建GStreamer(http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.16.1.bb?h=master)的RTSP服务器的方法
DEPENDS =“ gstreamer1.0 gstreamer1.0-plugins-base”
答案 1 :(得分:0)
我终于成功了,我要做的是使用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}
}