I am trying to compile ECL 16.1.2 under Android 6.0.1 in Termux environment (this has almost nothing to do with compiling for Android target --- just think of Termux as a GNU Linux implementation running on Android kernel). Termux is an Android application which provides GNU Linux environment, see here http://termux.com

(After installing Termux do "apt update && apt upgrade -y" and also install a myriad of applications to turn it into proper Linux development workstation, e.g. I always install the following (plus a plethora of python modules but they are irrelevant for this discussion):

apt install autoconf automake bc binutils-dev bison bzip2 cboard clang-dev cmake coreutils ctags curl cvs diffutils dnsutils dos2unix dpkg-dev ecj elfutils-dev \
            elinks expect-dev fftw-dev ffmpeg-dev file-dev findutils flac flex-dev freetype-dev gawk-dev gcal gdb-dev git glib-dev glib-bin gnuchess gnuplot grep gzip htop iconv imagemagick-dev \
            lftp libandroid-glob-dev openssh libtool-dev libpng libpng-dev libtiff libtiff-dev libtiff-utils ltrace strace mc man-dev make-dev \
            lua-dev luarocks mlocate ncurses-dev ncurses-utils nmap patch p7zip php-dev pkg-config mpv procps python-dev qalc rsync sed tar taskwarrior tcl-dev termux-api \
            tesseract-dev tmate tracepath tree units unzip unrar vim wget zip linux-man-pages

but a smaller subset should be sufficient, e.g. surely one doesn't need gnuchess/cboard to compile ECL :)

So, in order to configure ECL 16.1.2 I did the following after unpacking the sources:

1. $ export CONFIG_SHELL = $SHELL

2. Fix all configure and config.guess scripts to not use #!/bin/sh because under Termux the shell is $PREFIX/bin/bash (and /bin is not accessible):

$ find -name 'configure' -exec termux-fix-shebang {} \;
$ find -name 'config.guess' -exec termux-fix-shebang {} \;

3. $ ./configure --prefix=$PREFIX/local

This succeeds. And so I go on to

4. $ make

(this fails but due to a trivial thing --- some Makefiles contain hardcoded "/bin/sh" references --- so I fix all these to refer to the proper location of bash in Termux)

5. Re-run make after all these changes and it fails here:

$ make
cd build; make
make[1]: Entering directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build'
if (echo c gc libffi atomic | grep gmp); then \
  cd gmp && make install && \
  cd .. && mv include/gmp.h ecl/ && rmdir include &&  \
  mv ./libgmp.a ./libeclgmp.a; \
test -d ecl/gc || mkdir ecl/gc
test -d ecl/gc/private || mkdir ecl/gc/private
if (echo c gc libffi atomic | grep gc); then \
  cd gc && make install && cd .. && \
  cp -rf /data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/include/private/*.h ecl/gc/private/ && \
  mv libgc.a libeclgc.a; \
c gc libffi atomic
make[2]: Entering directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/gc'
make[3]: Entering directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/gc'
depbase=`echo dyn_load.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/data/data/com.termux/files/usr/bin/bash ./libtool  --tag=CC   --mode=compile gcc -fPIC -DHAVE_CONFIG_H   -I./include -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/include -I./libatomic_ops/src -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/libatomic_ops/src -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/ecl -fexceptions -Wall -Wextra -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -D_THREAD_SAFE -fno-strict-aliasing -MT dyn_load.lo -MD -MP -MF $depbase.Tpo -c -o dyn_load.lo /data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/dyn_load.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -fPIC -DHAVE_CONFIG_H -I./include -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/include -I./libatomic_ops/src -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/libatomic_ops/src -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/ecl -fexceptions -Wall -Wextra -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -D_THREAD_SAFE -fno-strict-aliasing -MT dyn_load.lo -MD -MP -MF .deps/dyn_load.Tpo -c /data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/dyn_load.c -o dyn_load.o
/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/dyn_load.c:116:14: error: redefinition of 'link_map'
      struct link_map {
/data/data/com.termux/files/usr/include/link.h:57:8: note: previous definition is here
struct link_map {
/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/bdwgc/dyn_load.c:123:14: error: redefinition of 'r_debug'
      struct r_debug {
/data/data/com.termux/files/usr/include/link.h:66:8: note: previous definition is here
struct r_debug {
2 errors generated.
make[3]: *** [Makefile:1527: dyn_load.lo] Error 1
make[3]: Leaving directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/gc'
make[2]: *** [Makefile:1710: install-recursive] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build/gc'
make[1]: *** [Makefile:123: libeclgc.a] Error 2
make[1]: Leaving directory '/data/data/com.termux/files/home/Maxima/ecl-16.1.2/build'
make: *** [Makefile:70: all] Error 2

So, then I check that those two definitions (link_map and r_debug) in dyn_load.c are compatible with the system ones in link.h and comment them out. Then I restart make and it goes on successfully for quite a while until failing here:

libtool: compile:  gcc -fPIC -DHAVE_CONFIG_H -I. -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi -I. -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/include -Iinclude -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/src -I. -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/include -Iinclude -I/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/src -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -D_THREAD_SAFE -MT src/arm/sysv.lo -MD -MP -MF src/arm/.deps/sysv.Tpo -c /data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/src/arm/sysv.S -o src/arm/sysv.o
/data/data/com.termux/files/home/Maxima/ecl-16.1.2/src/libffi/src/arm/sysv.S:399:2: error: invalid instruction
 stmeqia r2, {r0, r1}

And this is where I get stuck because I don't know ARM instruction set. I am a Linux kernel developer (or was, many years ago) and know C and a bit of asm for x86 architecture, but not ARM.

Any ideas?

Btw, the reason I am trying to compile ECL for Termux is because the next step would be to compile Maxima. I know that there is already Maxima for Android but it is a GUI version and so not very convenient for the real work. Real scientific work with Maxima can only be done in a text-based terminal version (and plotting is irrelevant as it is much more convenient to be done with python's matplotlib anyway which works perfectly under Termux).

Kind regards,