linaro-swg / optee_examples

OP-TEE Sample Applications
Other
163 stars 140 forks source link

ModuleNotFoundError for 'new_module' in TA Build Process in qemu environment. #112

Closed TheBigFish closed 7 months ago

TheBigFish commented 8 months ago

I made modifications to the sign_encrypt.py code and imported a new module (let's call it new_module). Subsequently, I used pip install new_module and built optee_examples and optee_os within the optee_qemu environment.

While building a PTA (e.g., ta/pkcs#11), everything works fine, and I can observe that the Python version is 3.8.10, which accurately reflects the Python version on my computer. However, when building a TA within optee_examples, it fails with the error ModuleNotFoundError: No module named 'new_module'. Surprisingly, the Python version is reported as 3.9.7, which is not present on my computer. Could this be the Python version in the optee_qemu environment?

the questions are:

  1. Is the Python version in optee_qemu environment different from my computer?
  2. How can I resolve the ModuleNotFoundError for 'new_module' when building TAs in optee_examples?
  3. I need to test the code in QEMU, but I'm unsure about the resolution. Any guidance is appreciated.

Thanks!

jforissier commented 8 months ago

Hello @TheBigFish,

optee_examples is built via Buildroot (build/br-ext/package/optee_examples_ext/) so Python comes from the Buildroot environment. I don't know how you may extend that with your own module though... perhaps you could create your own package in build/br-ext/package? That's a Buildroot question really.

TheBigFish commented 7 months ago

Hello @jforissier, I resolved it by manually installing the 'package_name' in the Buildroot environment using 'pip install package_name -t'. It's a bit cumbersome and ugly, but it gets the job done. Thanks for your suggestion.