我正在尝试使用yocto / bitbake构建配方,但是在构建依赖项时遇到了麻烦。其中一些构建依赖项不会部署到目标上,它们只是在构建过程中被静态链接。因此,我的项目在构建之前需要先构建某些静态库和项目。在配方中将它们指定为“ DEPENDS”,并且可以正确构建它们。
但是,当我的项目尝试在do_configure中运行cmake部分时,cmake输出会抱怨找不到找不到的库。有什么办法可以参考配方中的软件包,以便bitbake可以找到库?还是有更好的方法让cmake知道在哪里可以找到所需的文件?
# This is the basis of a recipe and may need further editing in order to be fully functional.
# (Feel free to remove these comments when editing.)
# Unable to find any files that looked like license statements. Check the accompanying
# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.
#
# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if
# this is not accurate with respect to the licensing of the software being built (it
# will not be in most cases) you must specify the correct value before using this
# recipe for anything other than initial testing/development!
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
SRC_URI = "git://[path to git project].git;protocol=ssh"
# Modify these as desired
PV = "[Version]+git"
SRCREV = "[Revision]"
S = "${WORKDIR}/git"
DEPENDS = "libnl libtins cmake protobuf protobuf-c libnl jsoncpp"
noinst_LIBRARIES = "
inherit cmake
# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
EXTRA_OECMAKE = ""
do_configure () {
cd ${S}
cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" .
}
输出:
Log data follows:
| DEBUG: Executing python function externalsrc_configure_prefunc
| DEBUG: Python function externalsrc_configure_prefunc finished
| DEBUG: Executing shell function do_configure
| Protobuf autogeneration STARTED
| Protobuf autogeneration FINISHED
| -- Found Protobuf: Protobuf_LIBRARY-NOTFOUND;-lpthread (found version "2.6.1")
| -- Found Protobuf: Protobuf_LIBRARY-NOTFOUND;-lpthread;-lpthread (found version "2.6.1")
| CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
| Please set them or make sure they are set and tested correctly in the CMake files:
| GENL_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| JSON_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| NL_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| Protobuf_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
| TINS_LIBRARY
| linked by target "[project 1]" in directory [yocto dir]/build/workspace/sources/[my project]
| linked by target "[project 2]" in directory [yocto dir]/build/workspace/sources/[my project]
|
| -- Configuring incomplete, errors occurred!
| See also "[yocto dir]/build/workspace/sources/[my project]/CMakeFiles/CMakeOutput.log".
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at [yocto dir]/build/tmp/work/[target]/[my project]/[version]+git-r0/temp/log.do_configure.24245)
答案 0 :(得分:0)
在do_configure中手动调用cmake并不是一个好习惯。参见the manual:
使用CMake时,您的配方需要继承cmake类,并且您的配方不必包含do_configure任务。您可以通过将EXTRA_OECMAKE设置为传递配方所需的任何所需配置选项来进行一些调整。
OE向cmake的调用中添加诸如路径和工具链文件之类的重要参数的原因,请参见cmake.bbclass。
请尝试删除do_configure
并将自定义参数添加到EXTRA_OECMAKE
。