libgo portable on Android ?

20 views
Skip to first unread message

Greg T

unread,
Apr 8, 2026, 5:53:27 AM (2 days ago) Apr 8
to gofrontend-dev
Hello gofrontend-dev,

I hope this is the right place to ask this question. I'm fairly new to the GCC/compiler world, so please bear with me if some details are imprecise.

## Context

I'm developing an Android application that integrates multiple Go SDKs (business logic libraries). Currently, I'm using gomobile bind to produce .aar files for each SDK. However, I'm hitting a well-known issue: each .aar embeds its own Go runtime (libgojni.so), and loading multiple of them in the same process leads to runtime conflicts and crashes (SIGSEGV in runtime.(*mheap).allocNeedsZero, caused by two GC heaps competing).

## Idea

I came across gccgo/libgo and its dynamic linking philosophy: instead of embedding the runtime in each binary, binaries depend on a shared libgo.so at runtime. This seems like exactly the right architecture to solve my problem:

  libgo.so          ← shared Go runtime, loaded once
  libsdk1.so        ← depends on libgo.so
  libsdk2.so        ← depends on libgo.so

On Linux/glibc this works well. My question is about Android.

## Question

Android uses bionic as its libc instead of glibc. I noticed in the libgo README (under gcc/libgo) the following:

  "The libgo library has only been tested on GNU/Linux using glibc."

But also, encouragingly:

  "It should not be difficult to port to other operating systems."

I would like to ask:

1. Has anyone attempted to build libgo targeting aarch64-linux-android (using the Android NDK sysroot with bionic)?

2. What would be the main obstacles?

3. Is this something the community would consider a reasonable effort, or are there known fundamental blockers?

Any guidance, pointers to prior work, or honest assessment of feasibility would be greatly appreciated. I'm willing to contribute and test if someone can point me in the right direction.

Thank you for your time.

Greg T.
Reply all
Reply to author
Forward
0 new messages