I'm trying to cross-compile python with zlib support.
What I did and what is working:
- Downloaded Python source code (Python-3.6.5)
- Compiled zlib from Python folder:
#!/bin/sh
# Path to angstrom cross-compiler
CROSS_COMPILE=/home/angstrom/arm/bin
CC=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-gcc CXX=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-g++ AR=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ar LD=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ld \
RANLIB=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ranlib \
./configure \
--prefix=$HOME/python \
--enable-shared
- Copied compiled zlib library files to angstrom compiler location, just to be sure it is found.
- Configure Python:
#!/bin/sh
# Path to angstrom bin folder
CROSS_COMPILE=/home/angstrom/arm/bin
CC=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-gcc CXX=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-g++ AR=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ar LD=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ld \
RANLIB=$CROSS_COMPILE/arm-angstrom-linux-gnueabi-ranlib \
./configure --host=arm-angstrom-linux --target=arm-angstrom-linux-gnueabi \
--build=x86_64-linux-gnu --prefix=$HOME/python \
READELF==arm-angstrom-linux-gnueabi-readelf \
--disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes --enable-shared
- Activate zlib in Modules/Setup like discussed here.
- make & make install
#!/bin/sh
# Path to angstrom bin folder
CROSS_COMPILE=/home/toolchain/angstrom/arm/bin
make HOSTPYTHON=$HOME/python \
BLDSHARED="$CROSS_COMPILE/arm-angstrom-linux-gnueabi-gcc -shared" CROSS-COMPILE=arm-angstrom-linux-gnueabihf- \
CROSS_COMPILE_TARGET=yes HOSTARCH=arm-angstrom-linux BUILDARCH=arm-angstrom-linux-gnueabihf
make altinstall HOSTPYTHON=$HOME/python \
BLDSHARED="$CROSS_COMPILE/arm-angstrom-linux-gnueabi-gcc -shared" CROSS-COMPILE=arm-angstrom-linux-gnueabihf- \
CROSS_COMPILE_TARGET=yes HOSTARCH=arm-angstrom-linux BUILDARCH=arm-angstrom-linux-gnueabihf \
prefix=$HOME/python
The output of the make process states zlib was not compiled:
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Copying the compiled modules to the arm device, shows Python working but without zlib support.