我正在尝试通过zlib支持对python进行交叉编译。
我做了什么,正在做什么:
#!/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
make进程状态zlib的输出未编译:
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.
将已编译的模块复制到arm设备,可以显示Python的工作原理,但没有zlib支持。
答案 0 :(得分:0)
Python 将检测 setup.py
中的 zlib 和其他依赖项。在检测之前,它会在 CPPFLAGS
和 LDFLAGS
中搜索有效的包含目录和库目录。因此,在配置 Python 时尝试设置 CPPFLAGS
和 LDFLAGS
,如下所示:
CC=blah CXX=blah AR=blah LD=blah RANLIB=blah \
CPPFLAGS="-I$HOME/python/include" LDFLAGS="-L$HOME/python/lib" \
./configure blahblah