在Android上的Python 3.3.2+

Python 3.3.2+ on android

我一直在尝试为Android构建Python 3.3.2,但我遇到了死胡同。 我可能做错了什么。

这是我的buildcript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Unpack Python
tar xvjf Python-3.3.2.tar.bz2
cd Python-3.3.2

# Setup Android NDK vars
export NDK=/home/jakob/dev/android/android-ndk-r9
export CROSS_COMPILE=arm-linux-androideabi
export CC=${CROSS_COMPILE}-gcc
export CXX=${CROSS_COMPILE}-g++
export SYSROOT=$NDK/platforms/android-18/arch-arm
export PATH=$PATH:$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/

# Create config.site file
echo 'ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no'
> config.site

# Configure
CONFIG_SITE=config.site ./configure --build=x86-unknown-linux-gnu --host=$CROSS_COMPILE --disable-ipv6 LDFLAGS="-Wl,--allow-shlib-undefined -L$SYSROOT/usr/lib" CFLAGS="-mandroid -fomit-frame-pointer --sysroot $SYSROOT"

# Build
make

这是make的输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Modules/python.o ./Modules/python.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/grammar1.o Parser/grammar1.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/listnode.o Parser/listnode.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/node.o Parser/node.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/parser.o Parser/parser.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/bitset.o Parser/bitset.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/metagrammar.o Parser/metagrammar.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/firstsets.o Parser/firstsets.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/grammar.o Parser/grammar.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/pgen.o Parser/pgen.c
Parser/pgen.c: In function 'compile_atom':
Parser/pgen.c:282:9: warning: variable 'i' set but not used [-Wunused-but-set-variable]
    int i;
        ^
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/myreadline.o Parser/myreadline.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/parsetok.o Parser/parsetok.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/tokenizer.o Parser/tokenizer.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/abstract.o Objects/abstract.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/accu.o Objects/accu.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/boolobject.o Objects/boolobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/bytes_methods.o Objects/bytes_methods.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/bytearrayobject.o Objects/bytearrayobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/bytesobject.o Objects/bytesobject.c
Objects/bytesobject.c: In function 'PyBytes_FromFormatV':
Objects/bytesobject.c:277:25: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'Py_ssize_t' [-Wformat=]
                        va_arg(vargs, Py_ssize_t));
                        ^
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/cellobject.o Objects/cellobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/classobject.o Objects/classobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/codeobject.o Objects/codeobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/complexobject.o Objects/complexobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/descrobject.o Objects/descrobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/enumobject.o Objects/enumobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/exceptions.o Objects/exceptions.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/genobject.o Objects/genobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/fileobject.o Objects/fileobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/floatobject.o Objects/floatobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/frameobject.o Objects/frameobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/funcobject.o Objects/funcobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/iterobject.o Objects/iterobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/listobject.o Objects/listobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/longobject.o Objects/longobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/memoryobject.o Objects/memoryobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/methodobject.o Objects/methodobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/moduleobject.o Objects/moduleobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/namespaceobject.o Objects/namespaceobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/object.o Objects/object.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/obmalloc.o Objects/obmalloc.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/capsule.o Objects/capsule.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/rangeobject.o Objects/rangeobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/setobject.o Objects/setobject.c
Objects/setobject.c: In function 'set_insert_key':
Objects/setobject.c:217:25: warning: typedef 'lookupfunc' locally defined but not used [-Wunused-local-typedefs]
    typedef setentry *(*lookupfunc)(PySetObject *, PyObject *, Py_hash_t);
                        ^
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/sliceobject.o Objects/sliceobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/structseq.o Objects/structseq.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/tupleobject.o Objects/tupleobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/typeobject.o Objects/typeobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/unicodeobject.o Objects/unicodeobject.c
Objects/unicodeobject.c: In function '_Py_ReleaseInternedUnicodeStrings':
Objects/unicodeobject.c:14301:13: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'Py_ssize_t' [-Wformat=]
            n);
            ^
Objects/unicodeobject.c:14327:13: warning: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'Py_ssize_t' [-Wformat=]
           "mortal/immortal
"
, mortal_size, immortal_size);
            ^
Objects/unicodeobject.c:14327:13: warning: format '%zd' expects argument of type 'signed size_t', but argument 4 has type 'Py_ssize_t' [-Wformat=]
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/unicodectype.o Objects/unicodectype.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Objects/weakrefobject.o Objects/weakrefobject.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/_warnings.o Python/_warnings.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/Python-ast.o Python/Python-ast.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/asdl.o Python/asdl.c
make Parser/pgen
make[1]: Entering directory `/home/jakob/dev/qt5/Python-3.3.2'
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/dynamic_annotations.o Python/dynamic_annotations.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/mysnprintf.o Python/mysnprintf.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Python/pyctype.o Python/pyctype.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/tokenizer_pgen.o Parser/tokenizer_pgen.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/printgrammar.o Parser/printgrammar.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/parsetok_pgen.o Parser/parsetok_pgen.c
arm-linux-androideabi-gcc -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -mandroid -fomit-frame-pointer --sysroot /home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm    -I. -IInclude -I./Include    -DPy_BUILD_CORE -o Parser/pgenmain.o Parser/pgenmain.c
arm-linux-androideabi-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Wl,--allow-shlib-undefined -L/home/jakob/dev/android/android-ndk-r9/platforms/android-18/arch-arm/usr/lib  Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Objects/obmalloc.o Python/dynamic_annotations.o Python/mysnprintf.o Python/pyctype.o Parser/tokenizer_pgen.o Parser/printgrammar.o Parser/parsetok_pgen.o Parser/pgenmain.o -ldl  -o Parser/pgen
/home/jakob/dev/android/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/home/jakob/dev/android/android-ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [Parser/pgen] Error 1
make[1]: Leaving directory `/home/jakob/dev/qt5/Python-3.3.2'

make: *** [Include/graminit.h] Error 2

因此,在开始使用pgen之前,everyhing看起来很不错,顺便说一下,它是为ARM构建的。 所以我不知道在主机系统上调用它是否有意义。

请帮忙。

谢谢Jakob Simon-Gaarde


FWIW我能通过kivy / buildozer + crystax在android上获得Python 3.5(在~/.buildozer/crystax-ndk-10.3.2中放置crystax)

安装Android Studio,以便在命令行中输入adb

Ubuntu 18.04中的Python 3.5

1
2
3
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install python3.5

获取最新最好的构建器(2018年秋季python3所需)

1
sudo -H pip install git+https://github.com/kivy/buildozer

做一个小试验台

1
2
3
mkdir py3android
cd py3android
mkdir src

SRC/ main.py

1
2
3
4
5
6
7
8
from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()

buildozer.spec(首先运行buildozer init创建骨架)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[app]
title = My App
package.name = myapp
package.domain = com.mycompany
source.dir = ./src
source.include_exts = py,png,jpg
source.include_patterns = img/
version = 0.1
requirements = python3crystax,kivy,git+git://github.com/wolfgangp/python-for-android
orientation = portrait
osx.python_version = 3
osx.kivy_version = 1.9.1
fullscreen = 0
android.ndk = 10.3.2
android.ndk_path = ~/.buildozer/crystax-ndk-10.3.2
android.entrypoint = org.renpy.android.PythonActivity


[buildozer]
log_level = 2
warn_on_root = 1

一旦接受此拉取请求,git库wolfgangp/python-for-android将被删除,然后可以将其更改为android==master

然后cd py3android,通过USB插入你的物理android设备(你也可以使用模拟器),只需运行buildozer android debug run logcat | grep -C 50 Traceback即可查看你的应用并将任何回溯打印到日志中。


你可以在python http://bugs.python.org/的问题跟踪器中报告这个