fyne-io/fyne · error

unimplemented; GOOS/CGO combination not supported

Error message

unimplemented; GOOS/CGO combination not supported

What it means

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'.

Source

Thrown at internal/driver/mobile/gl/work_other.go:16

// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (!cgo || (!darwin && !linux && !openbsd && !freebsd)) && !windows

package gl

// This file contains stub implementations of what the other work*.go files
// provide. These stubs don't do anything, other than compile (e.g. when cgo is
// disabled).

type context struct{}

func (*context) enqueue(c call) uintptr {
	panic("unimplemented; GOOS/CGO combination not supported")
}

func (*context) cString(str string) (uintptr, func()) {
	panic("unimplemented; GOOS/CGO combination not supported")
}

func (*context) cStringPtr(str string) (uintptr, func()) {
	panic("unimplemented; GOOS/CGO combination not supported")
}

type context3 = context

func NewContext() (Context, Worker) {
	panic("unimplemented; GOOS/CGO combination not supported")
}

func Version() string {
	panic("unimplemented; GOOS/CGO combination not supported")

View on GitHub (pinned to 8860ee95c3)

Solutions

  1. Rebuild with CGO_ENABLED=1 and a working C toolchain on darwin/linux/openbsd/freebsd/windows
  2. Add build tags to files that import the mobile driver so they only compile for supported platforms
  3. For wasm/headless targets use a driver/painter path that does not go through cgo GL

Example fix

// before - file compiled on every platform
import "fyne.io/fyne/v2/internal/driver/mobile/gl"

// after - restrict to builds that actually have cgo GL
//go:build cgo && (darwin || linux || openbsd || freebsd)

import "fyne.io/fyne/v2/internal/driver/mobile/gl"
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: prevent the stub from ever being linked on unsupported builds.
// Put this at the top of files that reference the mobile GL driver:
//
//go:build cgo && (darwin || linux || openbsd || freebsd)

// Runtime guard for shared code paths:
func glLikelyAvailable() bool {
    switch runtime.GOOS {
    case "windows":
        return true
    case "darwin", "linux", "openbsd", "freebsd":
        return true // requires CGO_ENABLED=1 at build time
    default:
        return false
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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