【问题标题】:Bitbake create cmake recipe from local sourcesBitbake 从本地资源创建 cmake 配方
【发布时间】:2021-02-14 23:20:55
【问题描述】:

我正在尝试使用 cmake 配方构建一个 helloworld 包示例。我的问题是 bitbake 给我一个错误,因为它在 /tmp/work/core2-64-poky-linux/helloworld/0.1-r0 文件夹中找不到 CMakeLists.txt。

错误:

helloworld-0.1-r0 do_configure: Execution of '/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/temp/run.do_configure.28001' failed with exit code 1:
CMake Error: The source directory "/path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/files" does not appear to contain CMakeLists.txt.

我的包在我的层 meta-mylayer/recipes-core/helloworld 中:

meta-mylayer/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-core
    └── helloworld
        ├── files
        │   ├── CMakeLists.txt
        │   └── main_helloworld.c
        └── helloworld_0.1.bb

我的 CMakeLists.txt :

cmake_minimum_required(VERSION 2.4)

project(helloworld)
file(GLOB_RECURSE files/*.c)

add_executable(app ${src_files})

install(TARGETS helloworld DESTINATION bin)

我的 helloworld_0.1.bb :

PN="helloworld"
PV="0.1"
P="${PN}-${PV}"
DESCRIPTION="This is my package helloworld"
LICENSE="CLOSED"
FILESEXTRAPATHS_prepend:="${THISDIR}/${PN}:"
RDEPENDS_${PN}+=""
DEPENDS+=""
DEPENDS+="cmake"

SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"

S="${WORKDIR}/files"

inherit pkgconfig cmake

我在 /path-to-tmp/tmp/work/core2-64-poky-linux/helloworld/0.1-r0/* 中找不到我的文件

为什么不复制文件?我正在使用 yocto Dunfell。

感谢您的帮助。

【问题讨论】:

    标签: cmake yocto bitbake


    【解决方案1】:

    当您在SRC_URI 中有文件时,它们将安装在${WORKDIR} 中。

    以下食谱可以解决问题:

    DESCRIPTION="This is my package helloworld"
    LICENSE="CLOSED"
    
    SRC_URI+="file://CMakeLists.txt file://main_helloworld.c"
    
    S="${WORKDIR}"
    
    inherit pkgconfig cmake
    

    另外,您的CMakeLists.txt 不应在files 目录中找到文件。

    S 设置为 ${WORKDIR},因为这是默认放置来自 file:// 提取器的文件的位置。

    DEPENDS 已经从您继承的 cmake bbclass 中包含 cmake-native。您不需要依赖 cmake,因为您依赖于 cmake-native(您需要在构建时执行 cmake,您不需要 cmake 标头或源代码)。

    添加的FILESEXTRAPATHS 默认情况下已被 bitbake 使用(而且它也与您的目录布局不匹配)。

    PNPV是从bb配方的文件名中获取的,不需要重新设置。

    【讨论】:

    • 非常感谢您的回复,解决了我的问题!
    猜你喜欢
    • 2021-03-12
    • 2018-01-03
    • 2022-11-11
    • 2016-03-17
    • 1970-01-01
    • 2017-06-09
    • 1970-01-01
    • 1970-01-01
    • 2022-01-01
    相关资源
    最近更新 更多