cosmos72 / twin

Text mode window environment. A "retro" program for embedded or remote systems, that doubles as X11 terminal and text-mode equivalent of VNC server
Other
651 stars 38 forks source link

Compiling and running on Termux (Android) #68

Closed ha5dzs closed 1 year ago

ha5dzs commented 2 years ago

Hi,

I have been using twin on my old laptop, and I thought it would be a good idea to install it on my android device too.

I am using a recent version of Termux, with all the up-to-date libraries. twin compiles fine after setting the ac_default_prefix variable to /data/data/com.termux/files/usr/local. I didn't change anything else, I just followed the steps on the tutorial. However, when I try to run it on my android device, I am getting the following output:

$ twin
WARNING: linker: /data/data/com.termux/files/usr/twin: unsupported flags DT_FLAGS_1=0x8000001
WARNING: linker: /data/data/com.termux/files/usr/twin_server: unsupported flags DT_FLAGS_1=0x8000001

..then it tries to load the various display driver modules. After each of them fails, it falls back to hw_tty, and I get the following error:

twin: unable to load display driver module `hw_tty' :
      dlopen failed: cannot locate symbol "Errstr" referenced by "/data/data/com.termux/files/usr/lib/twin/libhw_tty-0.9.1.so"

After this line, twin gives up and terminates.

I am not sure, but I think this may have something to do with not having ldconfig on Android. My compiler is clang version 13.0.0.

Can you give me any pointers on how to sort this out? Hopefully I just have a library missing...

Z

Mirppc commented 2 years ago

The only tip i could give is not to try, there are missing dependencies in the termux repo last i tried.

cosmos72 commented 2 years ago

I have not been able to compile twin on Termux - and not for lack of attempts.

On the other hand, I managed to compile and run twin on UserLand running debian, but can I only recommend it if you have a very large tablet - or external mouse and keyboard. Otherwise it's almost unusable from a small(ish) Android device.

If you want to use it as a server on Android, and attaching it to a larger display somewhere else, then of course the screen size on Android is not a factor :)

ha5dzs commented 2 years ago

I am using a Gemini PDA I bought from Planet Computers, which has a physical keyboard. The advantage of Termux is that you can configure the terminal interface, and you literally can pinch-zoom it to increase font size, and it resizes the terminal window dynamically. It can be useful when I want to copy and paste some output, and I can zoom out to have small letters if I want to see some logs or files being updated.

I managed to compile twin without any issues, I only had to install a couple of libraries, it only took me a couple of swings in the configure-make-make-install loop. It was so easy I can't even remember anything special about it! :) The entire 'system' is Debian-esque, and most things are working out of the box, minus the hardware management. I even have Midnight Commander installed. Everything works in this little isolated environment, kind of like chroot.

I have not been able to look at your code in detail yet, but can you tell me if this 'Errstr' thing is something you created internally? If not, and it should be in some library, I can try installing that library (or a different version of that library) and see if it works.

cosmos72 commented 2 years ago

Good to hear that :) Yes, Errstr is a function defined in one of the Twin sources.

ha5dzs commented 2 years ago

OK, will try to have a look.

cosmos72 commented 2 years ago

Fixed in commit 91ad9863ca1def2ab489d1082efb0245f7b0f376: compiling and running twin inside Termux now works.

At Termux prompt, you need to run:

apt update
apt install git build-essential ncurses
git clone https://github.com/cosmos72/twin
cd twin
./configure --prefix=/data/data/com.termux/files/usr
make
make install-strip
twin

Known issues: