yocto toolchains compile optee_example code ,ModuleNotFoundError: No module named 'Crypto'
Hi all,
I am playing imx8qm -iwave board.
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?
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 <module>
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
Solved! Go to Solution.
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/.
I have found the solution.
please install pycryptodome==3.7 on host opensuse mechine:
pip install pycryptodome==3.7
----
Before I played the old board maaxboard, the python is 2.6, but now it's 3.7. so need to install it.
sometimes ,I am confuse that the pycryptodome should be install in yocto toolcains (DEPENDS += "python3-pycryptodome-native python3-pyelftools-native") or in host machine.
I can find DEPENDS += "python3-pycryptodome-native python3-pyelftools-native" in optee_os.bb file,
so I installed my toolchains in my another ubuntu 18.or host machine. the compilation is passed ! so I thought the error was not in toolchain itself. it should be in host machine.
so I installed : pip install pycryptodome==3.7 on opensuse host. solved it!
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/.
I have found the solution.
please install pycryptodome==3.7 on host opensuse mechine:
pip install pycryptodome==3.7
----
Before I played the old board maaxboard, the python is 2.6, but now it's 3.7. so need to install it.
sometimes ,I am confuse that the pycryptodome should be install in yocto toolcains (DEPENDS += "python3-pycryptodome-native python3-pyelftools-native") or in host machine.
I can find DEPENDS += "python3-pycryptodome-native python3-pyelftools-native" in optee_os.bb file,
so I installed my toolchains in my another ubuntu 18.or host machine. the compilation is passed ! so I thought the error was not in toolchain itself. it should be in host machine.
so I installed : pip install pycryptodome==3.7 on opensuse host. solved it!
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/.