Zig on Termux

I want to write zig codes using Helix and VIM on Termux. I installed the zls and zig packages using pkg.But I need to learn about basic configurations and libc support.

If there are people who have developed Zig on Termux, I would like them to share their experiences with configurations, techniques, tips, etc.

Termux supports languages such as Rust and GO.They usually come with all batteries included.You can effortlessly write and run code in the Rust language with a single configuration. But I haven’t found the right configuration for zig yet.

What do I need to have a seamless development environment like the one on my computer? I’d like to hear your experiences on this subject. Thus, developing zig on Termux can also become effortless.

Update:

Because the libc requirement of the Zig compiler is not met by glibc on Termux (an Android Bionic-based library), I’m installing a Linux distro via proot on Termux and running the Zig development interface through that distro. It works flawlessly under Linux.

Have you tried musl builds?

-Dtarget=aarch64-linux-musl helps me using Zig on Termux.

Just got curious about that. Apparently, it kind of just works. I’m not sure what problems I will have, but just running zig run on a project generated by zig init works.
I did get some note about wrapper script, I guess they just made the thing work?
Oh yeah, I see it (potentially) uses proot under the hood.

I’ve only been able to get Zig to work well with termux from a proot distro.

The 2 issues I’ve had are

  • DNS lookup it broken, because of the weird hosts files location /data/data/…/etc/hosts
  • c dependencies have a compile error, but I forget the error.