kyq_linux 发表于 2020-4-4 02:23:31

求一个Python-2.7.3-xcompile.patch

求一个Python-2.7.3-xcompile.patch

kyq_linux 发表于 2020-4-4 02:45:09

已经下载到了   我不能上传文件好像是。。。。

kyq_linux 发表于 2020-4-4 03:12:15


首先说下环境
python 版本: 2.7.3   
/* 下载地址 */
https://www.python.org/downloads/release/python-273/
交叉编译器arm-linux-gnueabi
gcc version 4.9.4 (Linaro GCC 4.9-2017.01)



第一步 先搞定能在ARM 环境下运行python

1. 编译python 可参考

https://www.cnblogs.com/hit-python/p/4079506.html/* 求毕业        */

以下是我的命令:

kyq@kyq:~/python/Python-2.7.3$

/*        这几步是为了编译出host的解释器        */                                               
                        ./configure
                        make python Parser/pgen
                        mv python hostpython
                        mv Parser/pgen Parser/hostpgen
                        make distclean
/*        给python源码打上交叉编译补丁        */
        patch -p1 < Python-2.7.3-xcompile.patch               
/*        交叉编译配置        */
                        CC=arm-linux-gnueabihf-gcc
                        CXX=arm-linux-gnueabihf-g++
                        AR=arm-linux-gnueabihf-ar
                        RANLIB=arm-linux-gnueabihf-ranlib
                                               
                        ./configure --host=arm-linux-gnueabihf --prefix=/home/kyq/python/Python-2.7.3/_install/
                       
                        make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gnueabihf- -shared" CROSS_COMPILE=arm-linux-gnueabihf- CROSS_COMPILE_TARGET=yes
                       
                        make install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gnueabihf- -shared" CROSS_COMPILE=arm-linux-gnueabihf- CROSS_COMPILE_TARGET=yes prefix=/home/kyq/python/Python-2.7.3/_install

/*        拷贝到开发板的文件系统中 */
                        /*        这里我是通过网络文件系统nfs 挂载的方式验证的        */
                        sudo cp -r _install/   /home/kyq/nfs/rootfs

        在_install/bin目录下./python就进入了python环境,输入exit()就退出python。






/*         出现的问题       */       
arm-linux-gnueabihf-gcc -c -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes-I. -IInclude -I./Include   -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
In file included from Include/Python.h:58:0,
               from ./Modules/python.c:3:
Include/pyport.h:243:13: error: #error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
#         error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
             ^
In file included from Include/Python.h:126:0,
               from ./Modules/python.c:3:
Include/modsupport.h:27:1: warning: ‘PyArg_ParseTuple’ is an unrecognized format function type [-Wformat=]
PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
^
Makefile:556: recipe for target 'Modules/python.o' failed
make: *** Error 1
/*        解决办法        */
在/home/kyq/python-2.7.3/pyconfig.h 中   947行
找到#undef PY_FORMAT_LONG_LONG,添加一行#define PY_FORMAT_LONG_LONG “ll”

/*         出现的问题       */       
Parser/pgen ./Grammar/Grammar ./Include/graminit.h ./Python/graminit.c
Parser/pgen: 1: Parser/pgen: Syntax error: word unexpected (expecting ")")
Makefile:562: recipe for target 'Parser/pgen.stamp' failed
make: *** Error 2
/*        解决办法        */
补丁打的不对重新打补丁去

yyy 发表于 2020-6-27 16:26:32

Python-2.7.3-xcompile.patch 文件能发我一下吗?邮箱 lixinhz@163.com 谢谢啦

kyq_linux 发表于 2020-6-28 11:22:48

yyy 发表于 2020-6-27 16:26
Python-2.7.3-xcompile.patch 文件能发我一下吗?邮箱谢谢啦

官网有的 刚看了下 我这虚拟机 都删了 哈哈哈哈
页: [1]
查看完整版本: 求一个Python-2.7.3-xcompile.patch