在 petalinux 中编译 gstreamer 应用程序时出错
Error compiling gstreamer app in petalinux
我正在尝试使用下一个头文件在 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}
但不幸的是仍然给出同样的错误...任何想法可能是什么 wrong/missing?
提前致谢。
我认为您缺少指向编译代码所需的 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"
我终于让它工作了,我所做的是使用 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}
}
我正在尝试使用下一个头文件在 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}
但不幸的是仍然给出同样的错误...任何想法可能是什么 wrong/missing?
提前致谢。
我认为您缺少指向编译代码所需的 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"
我终于让它工作了,我所做的是使用 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}
}