{"record":{"id":"26995ac49abff103","repo":"fyne-io/fyne","slug":"unsupported-goarch","errorCode":null,"errorMessage":"unsupported GOARCH: ","messagePattern":"unsupported GOARCH: ","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/fyne/internal/mobile/env.go","lineNumber":350,"sourceCode":"\n\tvar arch string\n\tswitch runtime.GOARCH {\n\tcase \"386\":\n\t\tarch = \"x86\"\n\tcase \"amd64\":\n\t\tarch = \"x86_64\"\n\tcase \"arm64\":\n\t\t// For darwin/arm64, see https://golang.org/cl/346153.\n\t\tif runtime.GOOS == \"darwin\" {\n\t\t\tarch = \"x86_64\"\n\t\t\tbreak\n\t\t}\n\t\tif runtime.GOOS == \"android\" { // termux\n\t\t\treturn \"linux-aarch64\"\n\t\t}\n\t\tfallthrough\n\tdefault:\n\t\tpanic(\"unsupported GOARCH: \" + runtime.GOARCH)\n\t}\n\treturn runtime.GOOS + \"-\" + arch\n}\n\ntype ndkToolchain struct {\n\tarch        string\n\tabi         string\n\tminAPI      int\n\ttoolPrefix  string\n\tclangPrefix string\n}\n\nfunc (tc *ndkToolchain) ClangPrefix(api int) string {\n\tif api < tc.minAPI {\n\t\treturn fmt.Sprintf(\"%s%d\", tc.clangPrefix, tc.minAPI)\n\t}\n\treturn fmt.Sprintf(\"%s%d\", tc.clangPrefix, api)\n}","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/cmd/fyne/internal/mobile/env.go#L332-L368","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the packaging step inside an amd64 container or CI runner (docker run --platform linux/amd64 golang:...) - the produced APK is host-independent","Patch archNDK locally to return 'linux-aarch64' for linux/arm64 if your NDK ships that prebuilt and you must build natively","Update fyne or build the APK on a supported host and only deploy from the odd machine"],"exampleFix":"# before - panics on linux/arm64 or armhf hosts\nfyne package -os android -appID x.y -name MyApp\n\n# after - package inside an amd64 container\ndocker run --rm --platform linux/amd64 -v \"$PWD\":/app -w /app golang:1.22 \\\n  sh -c 'go install fyne.io/fyne/v2/cmd/fyne@latest && fyne package -os android'","handlingStrategy":"fallback","validationCode":"// Pre-flight: detect unsupported build-host architecture and reroute to a container.\nfunc hostSupported() bool {\n    switch {\n    case runtime.GOARCH == \"amd64\", runtime.GOARCH == \"386\":\n        return true\n    case runtime.GOARCH == \"arm64\" && runtime.GOOS == \"darwin\":\n        return true // Rosetta x86_64 prebuilt\n    case runtime.GOARCH == \"arm64\" && runtime.GOOS == \"android\":\n        return true // termux linux-aarch64\n    default:\n        return false\n    }\n}\nif !hostSupported() { /* fall back: docker run --platform linux/amd64 ... */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run Android packaging in an amd64 container or CI runner by default, regardless of host","Check 'uname -m' at the top of build scripts and skip packaging on unsupported hosts","Keep the NDK toolchain and fyne versions aligned with a host arch you know is supported"],"tags":["android","ndk","host-architecture","cross-compilation","go"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}