build: make LLVM 21 the default - #48
Conversation
There was a problem hiding this comment.
FennoAI Review
This PR switches the default LLVM version from 19 to 21 by swapping the build-tag roles between llvm_config_llvm19.go and llvm_config_llvm21.go, and updates the README accordingly.
The core change is correct. I verified across all llvm_config_llvm*.go files:
- Build tags are mutually exclusive — no tag combination selects two config files, and there is no version gap (an untagged build resolves to the new
llvm21catch-all default). llvm_config_llvm21.gocorrectly negates every explicitly-tagged version (14–20, 22) and its//go:build/// +buildlines are consistent.llvm_config_llvm19.gocorrectly transitions to the explicit!byollvm && llvm19gate.- README (versions list + "LLVM 21 is selected by default …
-tags=llvm19") matches the actual code.
[P1] CI workflow still treats LLVM 19 as the default — not updated by this PR
.github/workflows/go.yml was not touched, but it hard-codes the old default. All three "Test default LLVM" steps still gate on the LLVM 19 matrix row:
test-macos: line 30 —if: matrix.llvm == 19test-linux: line 55 —if: matrix.llvm == 19test-linux-fedora: line 78 —if: matrix.llvm == 19
Since the untagged go test -v build now links LLVM 21, these steps run the default build against an environment where only LLVM 19 is installed, while no job validates the new default against an LLVM 21 install. The test-linux-fedora job is also internally inconsistent: its install step already treats matrix.llvm == 21 as the default (line 69), but its test step still uses matrix.llvm == 19 (line 78).
Suggested fix: change those three if: matrix.llvm == 19 conditions to if: matrix.llvm == 21.
Minor (non-blocking, pre-existing)
- The
llvm21LinuxCPPFLAGS/LDFLAGSomit the/usr/lib64/llvm*/...fallback paths present in thellvm19/llvm20configs — a build-portability nit on RPM-based distros. Not introduced by this PR. - There is no
llvm_config_windows_llvm21.go; the only Windows-specific config is still pinned tollvm20. Windows users of the new default fall through to the generic config. - The two changed files retain legacy
// +buildlines while the sibling files have dropped them — a cosmetic inconsistency only.
Summary
llvm19build tagMotivation
LLGo is moving its revision-locked host and Espressif payload from LLVM 19 to LLVM 21. The binding already supports LLVM 21 APIs, including the
captures(none)transition, but its no-tag CGO configuration still selects LLVM 19.Keeping
llvm19explicit lets LLGo retain a compatibility lane while normal installs consistently select LLVM 21.Validation
go test ./...with Homebrew LLVM 21.1.8go test -tags=llvm19 ./...with Homebrew LLVM 19.1.7git diff --checkAfter merge, LLGo will consume this change from the next tagged module release (
v0.9.7).