我试图在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-构建-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路径以进行编译?
编辑
正如建议的那样,我在食谱中添加了“依赖”行:
#
# 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}但不幸的是,仍然给出相同的error...any想法,什么可能是错误的/缺失的?
提前谢谢。
发布于 2020-01-30 12:22:08
我终于让它起作用了,我所做的是使用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}
}发布于 2020-01-28 07:38:51
我认为您缺少指向编译代码所需的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 =“gStreer1.0gStreer1.0-plugins-base”
https://stackoverflow.com/questions/59936359
复制相似问题