我写了一个食谱,在Yocto中编译git repo。该存储库包含一个用于编译代码的Makefile。我第一次能够在Yocto中编译代码,但是当我在代码中添加jsoncpp库时,Yocto无法编译它。它显示出一些错误,例如
test_1.cpp:5:10: fatal error: jsoncpp/json/json.h: No such file or directory
| 5 | #include <jsoncpp/json/json.h>
| | ^~~~~~~~~~~~~~~~~~~~~
这是我的食谱文件。请建议我进行编译代码所需的更改。
yocto_test.bb
SUMMARY = "Hello World"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
DEPENDS = "jsoncpp"
SRCREV = "90052737ee51abca69a334a9208e2fec82d78c19"
SRC_URI = " \
git://github.com/arghyaBiswas05/yocto-test.git \
"
S = "${WORKDIR}/git/"
do_compile() {
oe_runmake all
}
# Install binary to final directory /usr/bin
do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}test_file ${D}${bindir}
}
这是我的Makefile
all:
${CXX} test_1.cpp -o test_file $(shell pkg-config --cflags --libs jsoncpp)
install:
cp test_file /usr/bin
clean:
rm -rf test_file
请建议我找零。
Makefile应该具有CXXFLAGS
和LDFLAGS
使用,而不是硬编码JSONLIB
。Yocto相应地设置了这两个变量,它们必须能够找到您所拥有的配方提供的文件DEPENDS
。
如果我可以建议,使用介子,自动工具或cmake可能比手动编写Makefille更快。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句