1 Reply Latest reply on May 6, 2021 10:06 AM by gonewtinwind

    yocto zeus branch toolchains compile optee_example code ,ModuleNotFoundError: No module named 'Crypto'

    gonewtinwind

      Hi all,

      yocto zeus branch toolchains compile optee_example code ,ModuleNotFoundError: No module named 'Crypto'

      (maaxbaord sumo branch worked well).

       

      I use yocto toolchains to cross compile optee_example code,

      error happened:

      from Crypto.Signature import PKCS1_v1_5

      ModuleNotFoundError: No module named 'Crypto'

      but I find in toolchain folder, the Crypto folder is there:

      ./sysroots/aarch64-poky-linux/usr/lib/python3.7/site-packages/Crypto

      It seems the compiler can not find it ?

      I have added :

      IMAGE_INSTALL_append +=" python3-pycryptodome " in local.conf

      any help?

      About 2 year ago,I posted a similar question #3441 but that was in yocto bitbake process in early, could not generate the yocto image.
      Today I play another board, I can build the image and the toolchain, the new issue is the toolchain compiler can not find the 'Crypto'

      Thank you.

      error:

      aarch64-poky-linux-gcc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux -o optee_example_aes main.o -lteec -L/opt/fsl-imx-xwayland/5.4-zeus/sysroots/aarch64-poky-linux/usr//lib

      make[1]: Leaving directory '/opt/oe/iw/iw-5.4.24/optee_examples/aes/host'

      make -C ta CROSS_COMPILE="aarch64-poky-linux-" LDFLAGS=""

      make[1]: Entering directory '/opt/oe/iw/iw-5.4.24/optee_examples/aes/ta'

      CC aes_ta.o

      CC user_ta_header.o

      CPP ta.lds

      LD 5dbac793-f574-4871-8ad3-04331ec17f24.elf

      OBJDUMP 5dbac793-f574-4871-8ad3-04331ec17f24.dmp

      OBJCOPY 5dbac793-f574-4871-8ad3-04331ec17f24.stripped.elf

      SIGN 5dbac793-f574-4871-8ad3-04331ec17f24.ta

      Traceback (most recent call last):

      File "/usr/local/optee/sysroots/aarch64-poky-linux/usr/include/optee/export-user_ta_arm64//scripts/sign.py", line 78, in

      main() 

      File "/usr/local/optee/sysroots/aarch64-poky-linux/usr/include/optee/export-user_ta_arm64//scripts/sign.py", line 31, in main

      from Crypto.Signature import PKCS1_v1_5 

      ModuleNotFoundError: No module named 'Crypto'

      /usr/local/optee/sysroots/aarch64-poky-linux/usr/include/optee/export-user_ta_arm64/mk/link.mk:60: recipe for target '5dbac793-f574-4871-8ad3-04331ec17f24.ta' failed

      make[1]: *** [5dbac793-f574-4871-8ad3-04331ec17f24.ta] Error 1

      make[1]: Leaving directory '/opt/oe/iw/iw-5.4.24/optee_examples/aes/ta'

      Makefile:9: recipe for target 'all' failed

      make: *** [all] Error 2

        • Re: yocto zeus branch toolchains compile optee_example code ,ModuleNotFoundError: No module named 'Crypto'
          gonewtinwind

          finally, I have found the solutions. I did  it 2 years ago for imx7 board. I remember again.

          do not need to modify the recipe.

          the toolchain does not include the Crypto package

          just manually copy Crypto to toolchain(I do not know how to modify somewhere in the compilation process to copy directly to make it, if someone knows how to do .please tell me ,thank you)

           

           

           

           

          sudo cp -r /home/rnd2/work/maaxboard/zeus/imx-yocto-bsp/maaxboard/build/tmp/sysroots-components/x86_64/python3-pycrypto-native/usr/lib/python3.7/site-packages/Crypto  /opt/fsl-imx-wayland-lite/5.4-zeus/sysroots/x86_64-pokysdk-linux/usr/lib/python3.7/site-packages/.