TCOBS Setup (Windows, macOS, Linux)
April 29, 2026 ยท View on GitHub
This repository contains CGO-based code paths.
If a C compiler is missing or not visible in PATH, tools like go list/gopls and commands like go test ./... can fail.
1) Required versions
- Go:
1.19+(seego.mod) - C compiler toolchain:
- Windows:
gccfrom MSYS2 (UCRT64 recommended) - macOS:
clangfrom Xcode Command Line Tools - Linux:
gcc(build-essential/ equivalent)
- Windows:
2) Install compiler toolchain
Windows
- Install MSYS2: https://www.msys2.org/
- In MSYS2 UCRT64 shell:
pacman -S --needed mingw-w64-ucrt-x86_64-toolchain
- Add to User PATH (permanent), in this order:
C:\msys64\ucrt64\binC:\msys64\usr\bin
PowerShell (copy/paste) to prepend both paths to User PATH:
$add = 'C:\msys64\ucrt64\bin;C:\msys64\usr\bin'
$cur = [Environment]::GetEnvironmentVariable('Path','User')
if ([string]::IsNullOrWhiteSpace($cur)) {
[Environment]::SetEnvironmentVariable('Path', $add, 'User')
} elseif ($cur -notlike '*C:\msys64\ucrt64\bin*') {
[Environment]::SetEnvironmentVariable('Path', "$add;$cur", 'User')
}
If you use mingw64 instead of ucrt64, use:
C:\msys64\mingw64\binC:\msys64\usr\bin
PowerShell (copy/paste) for mingw64:
$add = 'C:\msys64\mingw64\bin;C:\msys64\usr\bin'
$cur = [Environment]::GetEnvironmentVariable('Path','User')
if ([string]::IsNullOrWhiteSpace($cur)) {
[Environment]::SetEnvironmentVariable('Path', $add, 'User')
} elseif ($cur -notlike '*C:\msys64\mingw64\bin*') {
[Environment]::SetEnvironmentVariable('Path', "$add;$cur", 'User')
}
- Close and reopen terminal/IDE.
macOS
xcode-select --install
Linux
Debian/Ubuntu:
sudo apt update
sudo apt install -y build-essential
Fedora/RHEL:
sudo dnf groupinstall -y "Development Tools"
Arch:
sudo pacman -S --needed base-devel
3) Verify environment
Windows PowerShell
go version
where gcc
gcc --version
$env:CGO_ENABLED='1'
go test ./...
macOS/Linux
go version
which gcc || which clang
gcc --version || clang --version
CGO_ENABLED=1 go test ./...
4) Fix for IDE go list / gopls CGO errors
Typical error:
go list failed to return CompiledGoFiles ... failure to perform cgo processing
This usually means the IDE process does not inherit the same PATH as your shell.
- Restart IDE after PATH changes.
- Configure IDE Go environment:
CGO_ENABLED=1PATHincludes your compiler runtime dirs (Windows: MSYS2 dirs above).
5) Optional local caches (useful in restricted environments)
Windows PowerShell
$env:GOCACHE = "$PWD\.gocache"
$env:GOMODCACHE = "$PWD\.gomodcache"
$env:CGO_ENABLED='1'
go test ./...
macOS/Linux
export GOCACHE="$PWD/.gocache"
export GOMODCACHE="$PWD/.gomodcache"
CGO_ENABLED=1 go test ./...