{"record":{"id":"62b7d3548288ef17","repo":"fyne-io/fyne","slug":"unimplemented-goos-cgo-combination-not-supported","errorCode":null,"errorMessage":"unimplemented; GOOS/CGO combination not supported","messagePattern":"unimplemented; GOOS/CGO combination not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/driver/mobile/gl/work_other.go","lineNumber":16,"sourceCode":"// Copyright 2019 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n//go:build (!cgo || (!darwin && !linux && !openbsd && !freebsd)) && !windows\n\npackage gl\n\n// This file contains stub implementations of what the other work*.go files\n// provide. These stubs don't do anything, other than compile (e.g. when cgo is\n// disabled).\n\ntype context struct{}\n\nfunc (*context) enqueue(c call) uintptr {\n\tpanic(\"unimplemented; GOOS/CGO combination not supported\")\n}\n\nfunc (*context) cString(str string) (uintptr, func()) {\n\tpanic(\"unimplemented; GOOS/CGO combination not supported\")\n}\n\nfunc (*context) cStringPtr(str string) (uintptr, func()) {\n\tpanic(\"unimplemented; GOOS/CGO combination not supported\")\n}\n\ntype context3 = context\n\nfunc NewContext() (Context, Worker) {\n\tpanic(\"unimplemented; GOOS/CGO combination not supported\")\n}\n\nfunc Version() string {\n\tpanic(\"unimplemented; GOOS/CGO combination not supported\")","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/gl/work_other.go#L1-L34","documentation":"internal/driver/mobile/gl drives OpenGL through cgo workers; work_other.go is the stub compiled when cgo is disabled or GOOS is outside {darwin, linux, openbsd, freebsd, windows}. enqueue is the funnel every single GL call passes through (each gl.* function builds a call and enqueues it), so on a stub build the first GL operation after startup panics immediately with 'unimplemented; GOOS/CGO combination not supported'.","triggerScenarios":"Compiling or running code that reaches the mobile GL stack with CGO_ENABLED=0, or on a GOOS like js, plan9, aix or solaris - e.g. 'GOOS=js go build' of a program importing the mobile driver, or a gomobile bind without a working C toolchain.","commonSituations":"Wasm builds accidentally pulling in the mobile driver; CI lint/build steps using CGO_ENABLED=0 whose tests then execute GL calls; shared code missing platform build tags.","solutions":["Rebuild with CGO_ENABLED=1 and a working C toolchain on darwin/linux/openbsd/freebsd/windows","Add build tags to files that import the mobile driver so they only compile for supported platforms","For wasm/headless targets use a driver/painter path that does not go through cgo GL"],"exampleFix":"// before - file compiled on every platform\nimport \"fyne.io/fyne/v2/internal/driver/mobile/gl\"\n\n// after - restrict to builds that actually have cgo GL\n//go:build cgo && (darwin || linux || openbsd || freebsd)\n\nimport \"fyne.io/fyne/v2/internal/driver/mobile/gl\"","handlingStrategy":"validation","validationCode":"// Pre-flight: prevent the stub from ever being linked on unsupported builds.\n// Put this at the top of files that reference the mobile GL driver:\n//\n//go:build cgo && (darwin || linux || openbsd || freebsd)\n\n// Runtime guard for shared code paths:\nfunc glLikelyAvailable() bool {\n    switch runtime.GOOS {\n    case \"windows\":\n        return true\n    case \"darwin\", \"linux\", \"openbsd\", \"freebsd\":\n        return true // requires CGO_ENABLED=1 at build time\n    default:\n        return false\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set CGO_ENABLED=1 explicitly in mobile/android build scripts","Add build tags to every file importing the mobile driver","Split CI: static analysis may run with cgo off, rendering tests must not"],"tags":["go","cgo","build-tags","opengl","mobile","platform-support"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}