Compiling Mogan under Android

With certain amounts of trial-and-errors, I succeeded to compile and run Mogan 1.1.1 on termux under Android. I will write up details when I have spare time. Here are some key points:

  1. First of all, one has to disable the phantom processes killing for Android 12+, otherwise many processes are killed tacitly, making compilation and something else failed. A guide can be found here. One can also look at this post.

  2. We install termux, then X11 and vnc. One should also install some libGL (I installed mesa) to run tigervnc, which is not mentioned in the previous wiki page. (Edit: thanks to this patch, mesa is already included into the dependency thus the extra step is no longer necessary.)

  3. Then we install termux-packages and setup. We enter the main directory of this package.

  4. Create a folder mogan under x11-packages, a build script build.sh (expand below), and compile via ./build-package.sh -I mogan as described in this page.

    build.sh
    # http(s) link to package home page.
    TERMUX_PKG_HOMEPAGE=https://mogan.app/
    
    # One-line, short package description.
    TERMUX_PKG_DESCRIPTION="A structured editor for science and technology"
    
    # License.
    TERMUX_PKG_LICENSE="GPL-3.0"
    
    # Who cares about package.
    # Specify yourself (Github nick, or name + email) if you wish to maintain the
    # package, fix its bugs, etc. Otherwise specify "@termux".
    # Please note that unofficial repositories are not allowed to reference @termux
    # as their maintainer.
    TERMUX_PKG_MAINTAINER="@termux"
    
    # Version.
    TERMUX_PKG_VERSION=1.1.1
    
    # URL to archive with source code.
    #TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/ed/ed-${TERMUX_PKG_VERSION}.tar.lz
    TERMUX_PKG_SRCURL=https://github.com/XmacsLabs/mogan/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
    
    # SHA-256 checksum of the source code archive.
    #TERMUX_PKG_SHA256=ad4489c0ad7a108c514262da28e6c2a426946fb408a3977ef1ed34308bdfd174
    TERMUX_PKG_SHA256=0d474267b7a777ae0fb22705c8515bfc24eb2de15ed69aa758dc51377fc6d9f9  
    
    TERMUX_PKG_DEPENDS="libc++, qt5-qtbase, qt5-qtsvg"
    
    termux_step_pre_configure(){
    	LDFLAGS+=" -lexecinfo"
    }
    
  5. The package is installed automatically after compilation (this seems dirty, but since termux is not a system, it seems acceptable), and we get a deb package in output directory. We can dpkg -i to “install” it so that later it is easier to use pkg remove to uninstall.


@darcy I am not sure whether there is an issue in cmake. I suspect that the current file cannot be compiled with clang/llvm (there seems no problem for gcc). I have to add -lexecinfo into LDFLAGS (as shown in the script below), otherwise there are errors during linking about the references backtrace() and backtrace_symbols() in /src/System/Misc/stack_trace.cpp. There is an if branch in the CMakeList.txt, and maybe we should add add_includes_ldflags there.

Update: This might be related to https://github.com/awslabs/aws-c-common/issues/322 which seems to indicate that backtrace etc. are not included in Android’s libc.

3 Likes

Furthermore, there is an extra problem, but I guess that it is not Mogan specific: I cannot use Morgan to open a file in my storage, which is shared through termux-setup-storage, with error:

TeXmacs] std-warning, Load error for XXX, Function not implemented

There is no problem using command-line tools such as neovim and touch under termux to open and modify these files.

Update: It turns out to be a problem on file locking: File locks in TeXmacs

It is also possible to compile Mogan under AnLinux. However, it seems to me that the performance is worse than that in termux directly. After all, AnLinux has an extra layer over termux.

We are working on the WASM port, once the WASM port is production ready, GNU TeXmacs or Mogan Editor will be accessible where there is a browser!

Click Try online on https://mogan.app/ .

4 Likes
2 Likes

Good news: incorporated into Termux.

It then suffices to install in Termux via pkg install mogan.

3 Likes

Can somebody take a screenshot? I would like to put the info on twitter.

Mogan under Termux, along with Qt Terminal and i3 window manager.

3 Likes

Thanks, added: https://twitter.com/gnu_texmacs/status/1613207192366202884

1 Like