Termux-app: how to run x86 programs?

Created on 5 Jul 2018  路  15Comments  路  Source: termux/termux-app

I was wondering if i can run x86 on termux...I have 64 bit system. is there 86_64 version of termux?

Most helpful comment

For x86_64: qemu-x86_64 ./path/to/binary
For x86 (32bit): qemu-i386 ./path/to/binary

As shown, just prefix it with qemu executable.

All 15 comments

@Dj-jom2x Which CPU architecture on your device ? Post output of uname -m.

Linux localhost 3.18.22+ #1 SMP PREEMPT Wed Dec 20 22:32:29 CST 2017 aarch64 Android

I really wanted to execute 32bit on this thing instead of installing on limbo :(

@Dj-jom2x You need a QEMU to run x86 programs which is available in my repository currently.

If your program is not complex (e.g. statically compiled binary), you can use qemu in user-mode:

  1. qemu-user-i386: https://termux.xeffyr.ml/dists/extra/main/binary-aarch64/qemu-user-i386_2.12.0-2_aarch64.deb
  2. qemu-user-x86_64: https://termux.xeffyr.ml/dists/extra/main/binary-aarch64/qemu-user-x86_64_2.12.0-2_aarch64.deb

I have used them to make fasm and pandoc available for Termux:

If your program is complex - use a qemu-system* packages, Limbo, or you need different device.
Termux can't execute programs for architectures different from host.

yes its static

btw i install it inside termux how to run it ?
using qemu?

For x86_64: qemu-x86_64 ./path/to/binary
For x86 (32bit): qemu-i386 ./path/to/binary

As shown, just prefix it with qemu executable.

omg your the best man... 10/10 thanks thanks.. you save me a lot of space.

Are those qemu binaries still available (or newer versions of them)? I can't access them.

qemu is available in unstable-repo.

@xeffyr Thank you. I knew that, but I wasn't sure if it contained your fixes. I assumed it was "plain vanilla" version :)

There no "plain vanilla" version for Termux. It just can't be compiled.
For vanilla version you will need to setup a chroot environment of Ubuntu/Debian/etc...

Thanks. I compiled statically a hello world program in C on x86_64 and then run qemu-x86_64 hello (on Android 9 Termux) and it is still consuming CPU cycles (5 minutes already) but no sign of "Hello, world!" output yet...

strace shows a loop like this:

futex(0x58ba03ef00, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x58ba03eecc, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x58ba03ef00, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x58ba03eecc, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x58ba03ef00, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x58ba03eecc, FUTEX_WAKE_PRIVATE, 2147483647) = 0

That why qemu is in "unstable packages". It works differently on different devices.
The most stable qemu packages are only that compiled for aarch64.

Probably I will need to downgrade qemu to 3.1.0 like was done for X11 packages, as v4.0.0 has really strange behaviour. Or try the newer 4.1.0 rc.

I have following (on ARM Termux installation):

(process:21183): GLib-CRITICAL **: 22:38:17.366: g_tree_ref: assertion 'tree != NULL' failed

(process:21183): GLib-CRITICAL **: 22:38:17.366: g_tree_destroy: assertion 'tree != NULL' failed

Didn't observed this previously...

Qemu is not running my 32 bits code

Was this page helpful?
0 / 5 - 0 ratings