【问题标题】:BitBake recipe for custom setup.py自定义 setup.py 的 BitBake 配方
【发布时间】:2018-08-20 17:58:48
【问题描述】:

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

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

但它没有引发 setup.py found 错误。 任何人都可以处理这样的问题吗?

【问题讨论】:

  • 你的继承行不应该有" 字符
  • 我的错误是依赖而不是继承(在主帖中更正)。还有其他建议吗?

标签: yocto bitbake recipe


【解决方案1】:

发生这种情况是因为 bitbake 不知道 setup.py 的存储位置 - 您需要使用 bitbake 生成的 ${S} 变量来提供完整路径脚本。

请阅读 do_install() 任务的工作原理 - link

【讨论】:

    【解决方案2】:

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

    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 = ""
    

    从基于 CMake 的 git 下载的项目已安装如下:

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

    但是当我调用配方来构建 (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 时,一切都按照我的假设进行。

    还有其他建议如何处理吗?

    【讨论】:

      【解决方案3】:

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

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-07-05
        • 2019-11-07
        • 2015-02-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-14
        相关资源
        最近更新 更多