Compile Python 2.7.5 was never thought by me. As this article written
i had to compile Python from scratch. Just to troubleshoot why
Python-for-android `distribute.sh -m ``kivy``` failed to build.
Here is the log:
And found out that `_math.o` is required since where it has
the _Py_log1p defined. I manually exec this compile and
linker command as follow:
$ pwd
/opt/phython-for-android/build/python/Python-2.7.5
$ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/_math.c -o Modules/_math.o
$ ar rc libpython2.7.a Modules/threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/zipimport.o Modules/symtablemodule.o Modules/arraymodule.o Modules/_math.
_math.c _math.h _math.o
$ ar rc libpython2.7.a Modules/threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/zipimport.o Modules/symtablemodule.o Modules/arraymodule.o Modules/_math.o Modules/cmathmodule.o Modules/mathmodule.o Modules/_struct.o Modules/timemodule.o Modules/operator.o Modules/_weakref.o Modules/_randommodule.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/stropmodule.o Modules/_functoolsmodule.o Modules/_elementtree.o Modules/datetimemodule.o Modules/_bisectmodule.o Modules/fcntlmodule.o Modules/selectmodule.o Modules/socketmodule.o Modules/md5module.o Modules/md5.o Modules/shamodule.o Modules/sha256module.o Modules/sha512module.o Modules/binascii.o Modules/parsermodule.o Modules/cStringIO.o Modules/cPickle.o Modules/zlibmodule.o Modules/xmlparse.o Modules/xmlrole.o Modules/xmltok.o Modules/pyexpat.o Modules/xxsubtype.o
$ ranlib libpython2.7.a
$ gcc -pthread -Xlinker -export-dynamic -o python Modules/python.o libpython2.7.a -lpthread -ldl -lutil -L/usr/local/lib -lz -lm
$ make
And Python 2.7.5 built success! I actually got the above syntax-es
from make, here how i did:
$ pwd
/opt/phython-for-android/build/python/Python-2.7.5
$ make -d > build.log
`make -d` will throw alot of commands that being executed.
Capture the output for later review and copy-paste. Share your
thought?
i had to compile Python from scratch. Just to troubleshoot why
Python-for-android `distribute.sh -m ``kivy``` failed to build.
Here is the log:
And found out that `_math.o` is required since where it has
the _Py_log1p defined. I manually exec this compile and
linker command as follow:
$ pwd
/opt/phython-for-android/build/python/Python-2.7.5
$ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/_math.c -o Modules/_math.o
$ ar rc libpython2.7.a Modules/threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/zipimport.o Modules/symtablemodule.o Modules/arraymodule.o Modules/_math.
_math.c _math.h _math.o
$ ar rc libpython2.7.a Modules/threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/zipimport.o Modules/symtablemodule.o Modules/arraymodule.o Modules/_math.o Modules/cmathmodule.o Modules/mathmodule.o Modules/_struct.o Modules/timemodule.o Modules/operator.o Modules/_weakref.o Modules/_randommodule.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/stropmodule.o Modules/_functoolsmodule.o Modules/_elementtree.o Modules/datetimemodule.o Modules/_bisectmodule.o Modules/fcntlmodule.o Modules/selectmodule.o Modules/socketmodule.o Modules/md5module.o Modules/md5.o Modules/shamodule.o Modules/sha256module.o Modules/sha512module.o Modules/binascii.o Modules/parsermodule.o Modules/cStringIO.o Modules/cPickle.o Modules/zlibmodule.o Modules/xmlparse.o Modules/xmlrole.o Modules/xmltok.o Modules/pyexpat.o Modules/xxsubtype.o
$ ranlib libpython2.7.a
$ gcc -pthread -Xlinker -export-dynamic -o python Modules/python.o libpython2.7.a -lpthread -ldl -lutil -L/usr/local/lib -lz -lm
$ make
And Python 2.7.5 built success! I actually got the above syntax-es
from make, here how i did:
$ pwd
/opt/phython-for-android/build/python/Python-2.7.5
$ make -d > build.log
`make -d` will throw alot of commands that being executed.
Capture the output for later review and copy-paste. Share your
thought?
Comments