如何强制bitbake找到我的库?

问题描述 投票:0回答:1

我正在尝试使用yocto / bitbake构建一个配方,但是我遇到了构建依赖项的问题。其中一些构建依赖项不会部署在目标上 - 它们只是在构建时静态链接。因此,我的项目需要在构建之前构建某些静态库和项目。这些在配方中指定为“DEPENDS”,它们可以正确构建。

但是,当我的项目尝试在do_configure中运行cmake部分时,cmake输出会抱怨它找不到已经生成的库。有什么方法可以参考配方中的包,所以bitbake可以找到库吗?或者,有没有更好的方法让cmake知道在哪里找到它需要的文件?

Recipe created by recipetool

# 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)
yocto bitbake openembedded
1个回答
0
投票

在do_configure中手动调用cmake不是一个好习惯。见the manual

当您使用CMake时,您的配方需要继承cmake类,而您的配方不必包含do_configure任务。您可以通过设置EXTRA_OECMAKE来传递任何特定于配方的配置选项,从而进行一些调整。

OE正在向cmake的调用添加路径和工具链文件等重要参数的原因,请参阅cmake.bbclass

请尝试删除do_configure并将自定义参数添加到EXTRA_OECMAKE

© www.soinside.com 2019 - 2024. All rights reserved.