自定义setup.py的BitBake配方

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

在我的食谱中,我必须下载git存储库并运行CMake。在CMake完成其工作后,创建了另外的目录OUT,其中包含我想在do_install中运行的setup.py文件?我试过了:

DEPENDS = "setuptools python" 
do_install () {
python OUT/setup.py install 
}

但它没有引发setup.py发现错误。谁能处理这样的问题?

yocto bitbake recipe
3个回答
0
投票

这是因为bitbake不知道setup.py存储在哪里 - 你需要使用bitbake生成的$ {S}变量来提供这个脚本的完整路径。

请阅读do_install()任务如何工作 - link


0
投票

目前我已经重新组织了我的食谱,如下所示:

LICENSE = "CLOSED"
BB_STRICT_CHECKSUM = "0"

inherit cmake setuptools pythonnative

DEPENDS = "boost udev python swig-native python-native python-setuptools-native cmake-native"

SRC_URI = " \
    git://github.com/my_repo.git;name=my_name \
    file://0001-system-install.patch \
"
SRCREV_my_name = "404ff3eeff0d79c15cbfdbc126c4bff2996baea6"

S = "${WORKDIR}/git"

PARALLEL_MAKEINST = ""

项目从gake基础上下载到CMake上,安装方式如下:

install(CODE "execute_process(COMMAND python \"${PROJECT_SOURCE_DIR}/python/setup.py\" \"install\")")

但是当我调用recipe来构建(bitbake my_recipe)或构建包含该配方的图像(bitbake my_image)时,我收到了这样的错误:

ERROR: pc-ble-driver-git-r0 do_compile: python setup.py build execution failed.
ERROR: pc-ble-driver-git-r0 do_compile: Function failed: do_compile (log file is located at /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502)
ERROR: Logfile of failure stored in: /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502
Log data follows:
| DEBUG: Executing shell function do_compile
| ERROR: python setup.py build execution failed.
| /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/recipe-sysroot-native/usr/bin/python-native/python: can't open file 'setup.py': [Errno 2] No such file or directory
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /build/yocto-fsl/build/tmp/work/cortexa7hf-neon-poky-linux-gnueabi/pc-ble-driver/git-r0/temp/log.do_compile.16502)
ERROR: Task (/build/yocto-fsl/sources/meta-slabs/recipes-external/pc-ble-driver/pc-ble-driver_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2195 tasks of which 2194 didn't need to be rerun and 1 failed.

附:在我的PC上,当我构建CMake项目并调用make install时,一切都按照我的假设进行。

任何其他建议如何处理?


-1
投票

尝试在配方文件中添加以下命令

distutils_do_compile() {                                                                                                                                       
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_stage_headers() {                                                                                                                                    
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_stage_all() {                                                                                                                                        
    :                                                                                                                                                          
}                                                                                                                                                              
distutils_do_install() {                                                                                                                                       
    :                                                                                                                                                          
} 

并查看下面的更多详细信息... ./poky/meta/classes/distutils-tools.bbclass

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