见Cross Compiling Python for Embedded Linux
CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure --host=arm-linux --build=x86_64-linux-gnu --prefix=/root/tftpboot/Python-2.7.3 make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu make install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gcc -shared" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=/root/tftpboot/Python-2.7.3
2. File transfer between PC and development board
tftp: tftp -l path/to/filename -r filename -g 192.168.*.*
3. File copy
- cp /your/path/bin/python2.7 /bin/python
or export PATH=/your/path/bin/:$PATH # OK210 development board will report an error
- Copy serial, Django and other Python libraries to the /lib/python2.7/site-packages/ directory.
4. Set Python related environment variables
Take Python 2.7.x as an example.
export PYTHONHOME=/your/path/ #export PYTHONPATH=$PYTHONHOME:$PYTHONHOME/lib/python2.7:$PYTHONHOME/lib:$PYTHONHOME/lib/python2.7/site-packages #export PATH=$PATH:$PYTHONHOME:$PYTHONPATH
5. sqlite3
Building SQLLite and other dependancies Thanks to Lothsahn’s 2.7.3 patch, it is now possible to build sqlite3, bz2, gz, ssl and ctypes. Lothsahn provides the following instructions: To do the compilation, the dependencies must be in the include and lib folder one path up from the python install. For example:/include <– header files go here /lib <– shared object files go here /Python-2.7.3 <—Python sources go here during compile Dependencies include libffi, sqlite, openssl, bzip2, zlib, etc.
1. Follow the Cross Compiling Python for Embedded Linux given by Paul Gibson above , but import sqlite3 will report an error, the reason is not clear yet.
I tried some solutions but failed. It might be a problem with the lib_dir path:
- Removing other search paths from the setup.py, but the one i had the ARM compiled library in, made it work. 测试也未通过。
http://stackoverflow.com/questions/12385634/shared-library-sqlite3-so-not-found-when-importing-sqlite3-on-python-2-6-6
- http://stackoverflow.com/questions/10654707/no-module-named-zlib-found
- http://stackoverflow.com/questions/6171210/building-python-and-more-on-missing-modules
3. Debian platform is successful. http://www.friendlyarm.net/forum/topic/2731
reference:
1. cross compile python, busybox, flex, bash and so on, ARM cross-compiling howto
2. A powerful example on the Internet, python-2.6.6:
Click and run python cross compiling for Embedded ARM Linux
3. Use python in the Friendly Arm Linux system http://112.124.9.243/?p=285
4. Porting python3 to the OK6410 development board of the ARM platform http://www.51bigfool.com/%E7%A7%BB%E6%A4%8Dpython3%E5%88%B0arm%E5%B9%B3%E5%8F%B0%E7%9A%84ok6410%E5%BC%80%E5%8F%91%E6%9D%BF.html
Attachment:
- After stripping, the debugging information will be removed and the executable file size will be much smaller. The command is as follows:
- ./configure --host=arm-linux CC=arm-linux-gcc AR=arm-linux-ar STRIP=arm-linux-strip RANLIB=arm-linux-ranlib
- Cross-compile of sqlite3
- # CC=arm-linux-gcc ./configure --prefix=/your/path/sqlite-3.7.14 --host=arm-linux --disable-tcl
#make && make install
- # CC=arm-linux-gcc ./configure --prefix=/your/path/sqlite-3.7.14 --host=arm-linux --disable-tcl
Previous article:ffmpeg ported to arm s3c2410
Next article:LOG4C porting to ARM platform process
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Meet at the MPS Core Cloud Exhibition Hall, challenge yourself with wisdom and courage, and win exclusive gifts!
- 【Silicon Labs Development Kit Review】+PG22 Hardware Resources
- MSP430fr6989 serial port DMA sending experimental routine
- Live FAQ|Microchip's Trusted Platform for CryptoAuthentication Series
- 【Qinheng Trial】7. TouchKey
- Former Chairman explains the new PCIe5.0 specification. Tektronix invites you to watch and win prizes
- Today I thought of the "collection economy", office workers are very busy
- In adjustment
- RISC-V MCU Development (Part 14): Help and Feedback
- PCB design, which tool software is the best?