[yocto] Problems finding python when using a cmake recipe

Burton, Ross ross.burton at intel.com
Thu Jul 14 04:04:45 PDT 2016


On 14 July 2016 at 11:22, <S.Jaritz at esa-grimma.de> wrote:

> I want to create a recipe for an application. This application is
> generated through cmake. In the cmake file "CMakeLists.txt" is the passage:
> ##############
> include(FindPythonInterp)
> include(FindPythonLibs)
> ....
> add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/error.cpp"
> "${CMAKE_BINARY_DIR}/error.hpp"non_existant_file
>     COMMENT "create error.cpp"
>     COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/mc2cpp.py"
> "${CMAKE_SOURCE_DIR}/Common/ErrorCodes/Error_Build/Errors.mc"
> "${CMAKE_BINARY_DIR}/error"
> )
> ##############
>
> This generates a header and a cpp file, which contains some error codes.
> When executing the cmake in my common environment it works fine. Under
> Bitbake it fails. Python is not found.
>

This is because the cmake class stops cmake from finding binaries on the
host.  I'm not convinced this is the right thing to do but haven't had the
time to research the problem.

Add OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" to your recipe after
inherit cmake and it will look for and find the Python interpretter in
/usr/bin.

Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160714/9e51aff2/attachment.html>


More information about the yocto mailing list