fyne-io/fyne · error

unsupported GOARCH:

Error message

unsupported GOARCH: 

What it means

archNDK() computes the NDK 'prebuilt' host directory name from the build host's own runtime.GOARCH. It supports 386 (x86), amd64 (x86_64), and arm64 only when GOOS is darwin (mapped to x86_64 for Rosetta) or android (termux, linux-aarch64); every other combination - including linux/arm64, linux/arm, riscv64, loong64 - hits the default branch and panics because no matching NDK prebuilt exists.

Source

Thrown at cmd/fyne/internal/mobile/env.go:350

	var arch string
	switch runtime.GOARCH {
	case "386":
		arch = "x86"
	case "amd64":
		arch = "x86_64"
	case "arm64":
		// For darwin/arm64, see https://golang.org/cl/346153.
		if runtime.GOOS == "darwin" {
			arch = "x86_64"
			break
		}
		if runtime.GOOS == "android" { // termux
			return "linux-aarch64"
		}
		fallthrough
	default:
		panic("unsupported GOARCH: " + runtime.GOARCH)
	}
	return runtime.GOOS + "-" + arch
}

type ndkToolchain struct {
	arch        string
	abi         string
	minAPI      int
	toolPrefix  string
	clangPrefix string
}

func (tc *ndkToolchain) ClangPrefix(api int) string {
	if api < tc.minAPI {
		return fmt.Sprintf("%s%d", tc.clangPrefix, tc.minAPI)
	}
	return fmt.Sprintf("%s%d", tc.clangPrefix, api)
}

View on GitHub (pinned to 8860ee95c3)

Solutions

  1. Run the packaging step inside an amd64 container or CI runner (docker run --platform linux/amd64 golang:...) - the produced APK is host-independent
  2. Patch archNDK locally to return 'linux-aarch64' for linux/arm64 if your NDK ships that prebuilt and you must build natively
  3. Update fyne or build the APK on a supported host and only deploy from the odd machine

Example fix

# before - panics on linux/arm64 or armhf hosts
fyne package -os android -appID x.y -name MyApp

# after - package inside an amd64 container
docker run --rm --platform linux/amd64 -v "$PWD":/app -w /app golang:1.22 \
  sh -c 'go install fyne.io/fyne/v2/cmd/fyne@latest && fyne package -os android'
Defensive patterns

Strategy: fallback

Validate before calling

// Pre-flight: detect unsupported build-host architecture and reroute to a container.
func hostSupported() bool {
    switch {
    case runtime.GOARCH == "amd64", runtime.GOARCH == "386":
        return true
    case runtime.GOARCH == "arm64" && runtime.GOOS == "darwin":
        return true // Rosetta x86_64 prebuilt
    case runtime.GOARCH == "arm64" && runtime.GOOS == "android":
        return true // termux linux-aarch64
    default:
        return false
    }
}
if !hostSupported() { /* fall back: docker run --platform linux/amd64 ... */ }

Prevention

When it happens

Trigger: Running Android packaging ('fyne package -os android' / gomobile) on a host whose GOARCH is not 386, amd64, darwin-arm64 or android-arm64 - classically a 32-bit Raspberry Pi, a Linux arm64 workstation, or riscv64/loong64 machines.

Common situations: Building APKs on Raspberry Pi OS 32-bit; native builds on Linux arm64 CI hardware (Graviton/Fuji); termux on 32-bit devices; unsupported-arch containers.

Related errors


AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15). Data as JSON: /api/errors/26995ac49abff103. Report an issue: GitHub.