Using Python module cffi in Yocto recipe

Viewed 158

I am trying to use the Python module cffi in a Yocto/OE recipe. I want to use the module in the recipe, not include it in the target image.

It works on my local machine, but fails on our build server with the following message:

Exception: Exception: Version mismatch: this is the 'cffi' package version 1.14.5, located in '<build directory of recipe that uses cffi>/1.0-r0/recipe-sysroot-native/usr/lib/python3.8/site-packages/cffi/api.py'.  When we import the top-level '_cffi_backend' extension module, we get version 1.11.5, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-36m-x86_64-linux-gnu.so'.  The two versions should be equal; check your installation.

The problem seems to be that there are two Python versions on the build server. The host machine has version 3.6 installed. And OE also builds version 3.8 itself ("native"). What happens is that the cffi backend is built using the native Python version. (The script setup.py that seems to control the build process for the backend explicitly calls the native Python in distutils3.bbclass.)

However the task in the recipe where I want to use cffi is executed with the host Python - although I inherit python3native. This version seems to look for shared libraries in /usr/lib/python3 where it finds an outdated version of the cffi backend.

Why are different Python versions used for building cffi and for executing the depending recipe? Which one should really be used - the host system's or the native one? How can I control which one is used?

0 Answers
Related