← Back to issue list

"loadinternal: cannot find runtime/cgo" with base: core20, go.mod but no cgo in code

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1883265
Type
issue
State
open
Author
~jdstrand
Labels
Created
Updated
Closed

Current evaluation

Go plugin build fails on core20 with CGO_ENABLED=0 because the plugin passes -ldflags -linkmode=external, causing ld to look for cgo runtime objects. No maintainer response; reporter found override-build workaround and suggested dropping linkmode when CGO is disabled.

Suggested action: needs triage

Reason: The issue has zero comments, no labels, and no maintainer interaction in ~5.5 years, so it has never been triaged. The underlying concern (go plugin unconditionally passing -linkmode=external even when CGO_ENABLED=0) is a plausible bug in the plugin's build logic, and the reporter provided a working override-build workaround, but no maintainer has assessed whether the current plugin still exhibits this behavior.

Impact: 40 Quick Win: 28.0 Staleness: 90 Complexity: 30 Confidence: 70 Support Request: 20

Issue body

Following https://snapcraft.io/docs/go-plugin, with a hello-world type application using golang 1.13, go.mod, base: core20, but with no cgo, using this: base: core20 parts: foo: plugin: go go-channel: 1.13/stable source: . source-type: git stage-packages: - gcc build-environment: - CGO_ENABLED: "0" # didn't help Then building I get: $ snapcraft ... Pulling foo Cloning into '/root/parts/foo/src'... done. Building foo + go mod download + go install -p 2 -ldflags -linkmode=external ./... # github.com/canonical/foo/cmd/foo loadinternal: cannot find runtime/cgo /snap/go/5828/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 /usr/bin/ld: cannot find Scrt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory collect2: error: ld returned 1 exit status Failed to build 'foo'. Recommended resolution: Check the build logs and ensure the part's configuration and sources are correct. Run the same command again with --debug to shell into the environment if you wish to introspect this failure. [2] I tried staging different things like build-essential and libc6-dev which gave different, but failing output always related to ld. What did work was: base: core20 parts: foo: plugin: go go-channel: 1.13/stable source: . source-type: git build-environment: - CGO_ENABLED: "0" # may not be required override-build: | go install -p 2 ./... (note I was able to drop stage-packages too). I wonder if it makes sense that if CGO_ENABLED=0, you drop -ldflags -linkmode=external? At the very least there seems to be a documentation opportunity.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 28.0
Staleness: 90
Complexity: 30
Confidence: 70
Support Request: 20
needs triage Go plugin build fails on core20 with CGO_ENABLED=0 because the plugin passes -ldflags -linkmode=external, causing ld to look for cgo runtime objects. No maintainer response; reporter found override-build workaround and suggested dropping linkmode when CGO is disabled.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 75
Support Request: 10
close stale Snapcraft go plugin fails building with core20 base and CGO_ENABLED=0 due to linker errors. No maintainer response or labels. Suggests adjusting ldflags or updating docs.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 45
Confidence: 85
Support Request: 15
close stale Untriaged bug report regarding Snapcraft's Go plugin failing to link when using core20 base and Go 1.13. Author provided a workaround and suggested plugin behavior changes. No maintainer response in over 5 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 20
close stale Unlabelled report about Snapcraft Go plugin linker failures with core20 base and CGO_ENABLED=0. Author provided a workaround and suggested dropping -linkmode=external or updating docs. No maintainer response in over 5 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 30
Confidence: 90
Support Request: 20
close stale Untriaged report of snapcraft go plugin linker failures with CGO_ENABLED=0 on core20/Go 1.13. No maintainer response in over five years.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.