2023-06-18 10:18 PM - edited 2023-06-18 10:22 PM
Hello,
I am a newcomer to embedded systems. I have a STM32MP157D-DK1 and I'm planning to develop some python applications to run on the A7 processor. I am encountering some issues.
1. I created a simple web application using Python on Ubuntu. (python module: Flask)
2. I confirmed that it can be executed successfully.
3. I bundled it into a single executable file using pyinstaller (PC $> pyinstaller app.py --onefile).
4. I verified that the executable file can be used properly.
5. I transferred the file to an STM32 (starter kit).
6. When I tried to execute the file, an error occurred.
Error Message:
./app: line 1: syntax error: unexpected ")"
Other experiments:
I try to execute python source code directly on STM32, there is no problem.
I try to bundle python code into a single executable on STM32, but can't install pyinstaller. (pip3 install pyinstaller)
Thanks for your support,
Ken.
2023-06-26 05:44 AM - edited 2023-06-26 06:01 AM
Hi @Ken_102633
The app you created with pyinstaller from your PC running ubuntu is compiled for an architecture compatible with your PC (most probably x86_64). However, STM32MP15 boards rely on a ARM architecture hence can't run x86_64 app. That explains the error you got in your 6th step.
Then, installing pyinstaller from pip3 shows errors as some build dependencies are not available such as a gcc toolchain. To bypass these dependencies, you need to build your own distribution and setup your own repository (please refer to https://wiki.st.com/stm32mpu/wiki/Package_repository_for_OpenSTLinux_distribution#How_to_activate_a_local_package_repository )
Once your repository is activated, install the package group core-buildessential:
root@stm32mp1:~# apt-get update
root@stm32mp1:~# apt-get install packagegroup-core-buildessential
# EDITED SECTION BELOW
root@stm32mp1:~# apt-get install ldd
You can now install pyinstaller with the following command:
root@stm32mp1:~# env PYI_STATIC_ZLIB=1 pip3 install pyinstaller
Then try to build your app.
Best regards,
--JM
2024-01-02 02:01 AM
Thank you so much @Jean-Marc B , the steps listed here helped to install and work with pyinstaller on stm device!