So installed the Termux app on both, which provides a single-user Linux environment based on a debian-like system, so you can install the necessary build tools with a package manager. The only C compiler available is Clang 5.0.0, though, there doesn't seem to be a GCC package.
Apart from a small issue with the build system, compilation on the tablet, which has an aarch64 architecture, went smoothly and the test suite had only 5 failed tests, which were due to differences in float representation.
On the phone however, which has an armv7l processor, the compilation failed with the following error. Is this expected? Is this architecture supported? Is this an incompatibility with clang?
Code: Select all
CC ../../py/nlrthumb.c
../../py/nlrthumb.c:79:5: error: non-ASM statement in naked function is not supported
return 0; // needed to silence compiler warning
^
../../py/nlrthumb.c:39:16: note: attribute is here
__attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
^
../../py/nlrthumb.c:95:5: error: non-ASM statement in naked function is not supported
nlr_buf_t **top_ptr = &MP_STATE_THREAD(nlr_top);
^
../../py/nlrthumb.c:94:25: note: attribute is here
NORETURN __attribute__((naked)) void nlr_jump(void *val) {
^
2 errors generated.
make: *** [../../py/mkrules.mk:47: build/py/nlrthumb.o] Error 1
- install F-Droid app
- install Termux app from within F-Droid
Code: Select all
pkg upgrade
pkg install python-dev git clang make pkg-config libffi-dev
mkdir -p src
cd src
git clone https://github.com/micropython/micropython
cd micropython/
git submodule update --init
sed -i -e 's|^MAKE_FROZEN = $(TOP)|MAKE_FROZEN = $(PYTHON) $(TOP)|' py/mkenv.mk
cd ports/unix/
export GCC=clang
make axtls
make
Code: Select all
pkg install autoconf automake libtool
cd ports/unix/
sed -i -e 's|^MICROPY_STANDALONE = 0|MICROPY_STANDALONE = 1|' mpconfigport.mk
export GCC=clang
make deplibs
make
Code: Select all
$ uname -a
Linux localhost 3.4.39-8954887 #1 SMP PREEMPT Fri Dec 9 19:32:20 KST 2016 armv7l Android
$ clang --version
clang version 5.0.0 (tags/RELEASE_500/final)
4 cat /proc/cpuinfo
Target: armv7a--linux-android
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin
Processor : ARMv7 Processor rev 3 (v7l)
processor : 0
BogoMIPS : 1590.88
processor : 1
BogoMIPS : 1590.88
processor : 2
BogoMIPS : 1590.88
processor : 3
BogoMIPS : 1590.88
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 3
Hardware : UNIVERSAL3470
Revision : 0006
Serial : 4c31135352000d13