1 # Installing QPMS on Android/AOSP (-based) systems
3 Yes, it is possible. Basically all you need is a device capable of running [Termux](https://termux.com/) with enough memory to build everything.
5 The following instructions have been tested with Termux version 0.118.0 on
6 [e/OS/ R development build on a Samsung Galaxy S10e](https://doc.e.foundation/devices/beyond0lte/install)
7 ([e-1.0-r-20220526188878-dev-beyond0lte](https://images.ecloud.global/dev/beyond0lte/)).
8 Presumably, they should work also on stock Android as well, but who
9 in their right mind would run all the spyware by Google & al.?
11 Physical keyboard or [remote access](https://wiki.termux.com/wiki/Remote_Access) is strongly recommended. :D
15 Just [install the Termux app from F-Droid or Github as per instructions](https://github.com/termux/termux-app#f-droid).
17 Open Termux; the following steps of these instructions are basically
18 just commands you need to type in Termux.
20 ## Install prerequisities from termux repositories
23 pkg install python3 cmake git clang build-essential binutils
26 ## Build and install GSL
29 curl -O https://www.nic.funet.fi/pub/gnu/ftp.gnu.org/pub/gnu/gsl/gsl-latest.tar.gz
30 tar xf gsl-latest.tar.gz
32 ./configure --prefix=$PREFIX
33 make # add -j4 or so to make it faster on multicore systems
38 ## Build and install OpenBLAS
41 git clone https://github.com/xianyi/OpenBLAS.git
44 make PREFIX=$PREFIX install
48 ### Workaround for "broken" setup.py script
50 The goal is to fix `setup.py` so that it finds the correct libraries automatically, but in the meantime, you can use this workaround to get the Python part of QPMS installed:
53 ln -s $PREFIX/lib/libopenblas.so $PREFIX/LIB/liblapacke.so
56 ## Build and install Numpy
58 (Successful build requires the `MATHLIB` environmental variable set, otherwise linking will fail; see https://wiki.termux.com/wiki/Python.)
61 MATHLIB=m pip3 install numpy
70 ## Build and install QPMS
73 git clone https://repo.or.cz/qpms.git
75 cmake -DCMAKE_INSTALL_PREFIX=$PREFIX . # ugly, TODO make a separate build tree!
78 python3 setup.py install
81 Hopefully, QPMS has installed successfully. At this point, you should be able
82 to import and use QPMS with some exceptions. First, there is some legacy code
83 in the `qpms.qpms_p` module (which is no longer imported automatically with
84 bare `import qpms`). You shouldn't need this unless you are trying to run some
85 historic Jupyter notebooks or other old custom scripts. It contains a scipy
86 dependence, and scipy is hard to get working in Android environment (as
87 it requires a Fortran compiler to build).
91 If you try to run just `pip3 install matplotlib` in Termux, it might likely
92 fail when installing the `pillow` dependency.
93 First, according to [Termux wiki](https://wiki.termux.com/wiki/Python#Python_module_installation_tips_and_tricks),
94 pillow depends on `libpng` and `libjpeg-turbo`, which are fortunately
95 available in Termux packages.
96 Second, pillow instalation requires an additional environment variable
97 `LDFLAGS="-L/system/lib64"` to be set on 64-bit devices.
101 pkg install libpng libjpeg-turbo
102 export LDFLAGS="-L/system/lib64" # on 64-bit devices
103 pip3 install matplotlib
106 After this step, you should be able to run the command-line scripts
107 from `misc/` directory and examples from `examples/` directory.