Reputation: 11
I'm trying to cross-compile python with zlib support.
What I did and what is working:
#!/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
#!/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
#!/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.
Upvotes: 1
Views: 1319
Reputation: 71
Python will detect zlib and other dependencies in setup.py
. Before detecting, it will search for valid include dirs and library dirs in CPPFLAGS
and LDFLAGS
. So try set CPPFLAGS
and LDFLAGS
like below while configuring Python:
CC=blah CXX=blah AR=blah LD=blah RANLIB=blah \
CPPFLAGS="-I$HOME/python/include" LDFLAGS="-L$HOME/python/lib" \
./configure blahblah
Upvotes: 2