【发布时间】:2017-09-25 12:00:37
【问题描述】:
我编写了一个包含 3 个文件的包:foo.c、foo.h 和 README.TXT。这是食谱:
DESCRIPTION = "foo Drivers"
#To prevent the LICENSE field not set
LICENSE = "CLOSED"
PR = "r0"
SRC_URI = "file://foo.c \
file://foo.h \
file://README.txt"
FILES_${PN} += "${incdir}/foo.h"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/foo.c -o foo
}
do_install() {
install -m 0755 -d ${D}${bindir} ${D}${docdir}/foo ${D}${incdir}
install -m 0755 ${S}/foo ${D}${bindir}
install -m 0755 ${WORKDIR}/README.txt ${D}${docdir}/foo
install -m 0755 ${WORKDIR}/foo.h ${D}${incdir}
}
但是当我做bitbake foo 时,我有这个错误:
WARNING: foo-0.0-r0 do_package: QA Issue: foo: Files/directories were installed but not shipped in any package:
/foo.h
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
foo: 1 installed and not shipped files. [installed-vs-shipped]
因此,在另一个依赖于 foo 的包中,当我添加配方时:DEPENDS = "foo",我有这个错误:
fatal error: foo.h: No such file or directory
错误来自#include <foo.h> 行。
感谢您的帮助!
编辑:
install -m 0755 ${WORKDIR}/foo.h ${D}${includedir}
解决了警告问题,但我仍然有:
fatal error: foo.h: No such file or directory
当我想根据 foo.h 编译一个包时
EDIT2: 我已经更改了我的 foo 包的 bblayer 以创建一个 .so 共享库,如下所示:
DESCRIPTION = "foo driver"
#To prevent the LICENSE field not set
LICENSE = "CLOSED"
PR = "r70"
SRC_URI = "file://foo.c \
file://foo.h \
file://README.txt"
CFLAGS_append =" -fPIC -g -c -Wall "
FILES_${PN} += "${libdir}/* ${libdir}/pkgconfig/*"
do_compile() {
${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/foo.c -o foo
${CC} -shared -Wl,-soname,${WORKDIR}/libfoo.so.1 \
-o ${WORKDIR}/libfoo.so.1.0.1 foo -lc
}
do_install() {
install -m 0755 -d ${D}${bindir} ${D}${libdir} ${D}${docdir}/foo ${D}${includedir} ${D}${libdir}/pkgconfig
install -m 0755 ${S}/foo ${D}${bindir}
install -m 0755 ${WORKDIR}/README.txt ${D}${docdir}/foo
install -m 0755 ${WORKDIR}/foo.h ${D}${includedir}
install -m 0755 ${WORKDIR}/libfoo.so.1.0.1 ${D}${libdir}
ldconfig -n ${D}${libdir}
}
但是在我的测试包中,即使我添加了#include <foo.h> 和DEPENDS = "pjproject gpio"
RDEPENDS_${PN} += "gpio",我也有来自foo.h 的error: undefined reference to 函数。这是我的测试bblayer:
DESCRIPTION = "test"
LICENSE = "CLOSED"
PR = "r2"
SRC_URI = "file://main.c \
file://Makefile \
file://README.txt"
S = "${WORKDIR}/"
DEPENDS = "gpio"
RDEPENDS_${PN} += "gpio"
do_compile() {
cd ${S}
oe_runmake
}
do_install() {
install -m 0755 -d ${D}${bindir} ${D}${docdir}/test
install -m 0755 ${S}/test ${D}${bindir}
install -m 0755 ${WORKDIR}/README.txt ${D}${docdir}/test
}
如果我在我的 Makefile 中添加-lfoo,我就有/bin/sh: 1: -lfoo: not found。
为什么?谢谢你的帮助!
【问题讨论】:
标签: include cross-compiling yocto bitbake