Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: TestScript failure with "requires external (cgo) linking, but cgo is not enabled" #65374

Closed
gopherbot opened this issue Jan 30, 2024 · 4 comments
Labels
Builders x/build issues (builders, bots, dashboards) GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@gopherbot
Copy link
Contributor

gopherbot commented Jan 30, 2024

#!watchflakes
post <- pkg == "cmd/go" && `requires external \(cgo\) linking, but cgo is not enabled` && date < "2024-01-31"

Issue created automatically to collect these failures.

Example (log):

=== RUN   TestScript/build_plugin_reproducible
=== PAUSE TestScript/build_plugin_reproducible
=== CONT  TestScript/build_plugin_reproducible
    script_test.go:132: 2024-01-30T00:28:55Z
    script_test.go:134: $WORK=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-3228132987/tmpdir1300124647/build_plugin_reproducible2039831068
    script_test.go:156: 
        PATH=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-3228132987/tmpdir1300124647/testbin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/cache/tools/bin:/home/swarming/.swarming/w/ir/bbagent_utility_packages:/home/swarming/.swarming/w/ir/bbagent_utility_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages:/home/swarming/.swarming/w/ir/cipd_bin_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3/bin:/home/swarming/.swarming/w/ir/cache/cipd_client:/home/swarming/.swarming/w/ir/cache/cipd_client/bin:/home/swarming/.swarming/cipd_cache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        HOME=/no-home
        CCACHE_DISABLE=1
        GOARCH=amd64
...
        
        > [!buildmode:plugin] skip
        [condition not met]
        > [short] skip
        [condition not met]
        > go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go
        [stderr]
        -buildmode=plugin requires external (cgo) linking, but cgo is not enabled
    script_test.go:156: FAIL: testdata/script/build_plugin_reproducible.txt:4: go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go: exit status 1
--- FAIL: TestScript/build_plugin_reproducible (0.11s)

watchflakes

@gopherbot gopherbot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 30, 2024
@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "cmd/go" && test == "TestScript/build_plugin_reproducible"
2024-01-30 00:16 gotip-linux-amd64-longtest go@4afb155c cmd/go.TestScript/build_plugin_reproducible (log)
=== RUN   TestScript/build_plugin_reproducible
=== PAUSE TestScript/build_plugin_reproducible
=== CONT  TestScript/build_plugin_reproducible
    script_test.go:132: 2024-01-30T00:28:55Z
    script_test.go:134: $WORK=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-3228132987/tmpdir1300124647/build_plugin_reproducible2039831068
    script_test.go:156: 
        PATH=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-3228132987/tmpdir1300124647/testbin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/cache/tools/bin:/home/swarming/.swarming/w/ir/bbagent_utility_packages:/home/swarming/.swarming/w/ir/bbagent_utility_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages:/home/swarming/.swarming/w/ir/cipd_bin_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3/bin:/home/swarming/.swarming/w/ir/cache/cipd_client:/home/swarming/.swarming/w/ir/cache/cipd_client/bin:/home/swarming/.swarming/cipd_cache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        HOME=/no-home
        CCACHE_DISABLE=1
        GOARCH=amd64
...
        
        > [!buildmode:plugin] skip
        [condition not met]
        > [short] skip
        [condition not met]
        > go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go
        [stderr]
        -buildmode=plugin requires external (cgo) linking, but cgo is not enabled
    script_test.go:156: FAIL: testdata/script/build_plugin_reproducible.txt:4: go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go: exit status 1
--- FAIL: TestScript/build_plugin_reproducible (0.11s)

watchflakes

@cherrymui cherrymui changed the title cmd/go: TestScript/build_plugin_reproducible failures cmd/go: TestScript failure with "requires external (cgo) linking, but cgo is not enabled" Jan 30, 2024
@bcmills
Copy link
Contributor

bcmills commented Jan 30, 2024

@mknyszek, I note CC=/home/swarming/.swarming/w/ir/cache/tools/clang/bin/clang in the test log — was there a change in the builder configuration for this test run?

@bcmills bcmills added Builders x/build issues (builders, bots, dashboards) GoCommand cmd/go labels Jan 30, 2024
@bcmills bcmills added this to the Go1.23 milestone Jan 30, 2024
@mknyszek
Copy link
Contributor

@bcmills Sorry, this is an infrastructure issue, and my fault. I made a (very) bad push yesterday that ended up polluting non-clang builds with clang-built Go toolchains. The Go toolchain ends up trying to use clang because the CC variable ends up go env, but clang is not installed.

As of last night, clang is now part of the key to look up a prebuilt toolchain, and so this shouldn't happen in the future. I've deleted the problematic prebuilt toolchains where I've seen them, since it doesn't seem so widespread that we'd need a full wipe. I went ahead and deleted the association for the Go toolchain in this issue, as well as another one that was reported to me today. This will cause harmless extra toolchain builds.

If this issue continues to pester us, I will simply wipe out all the prebuilt toolchain associations, so it shouldn't ever be a problem going forward. (I am reluctant to just do it because it will cause some in-progress builds, specifically test shards, to. fail, because they refuse to rebuild the toolchain themselves. However, perhaps that should be relaxed to make full wipes like this easier. I will look into.)

@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2024
@gopherbot
Copy link
Contributor Author

Found new dashboard test flakes for:

#!watchflakes
post <- pkg == "cmd/go" && `requires external \(cgo\) linking, but cgo is not enabled` && date < "2024-01-31"
2024-01-29 22:19 go1.22-linux-amd64-longtest release-branch.go1.22@117d7b10 cmd/go.TestScript/build_plugin_reproducible (log)
=== RUN   TestScript/build_plugin_reproducible
=== PAUSE TestScript/build_plugin_reproducible
=== CONT  TestScript/build_plugin_reproducible
    script_test.go:132: 2024-01-29T22:31:43Z
    script_test.go:134: $WORK=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-1625290363/tmpdir4100294628/build_plugin_reproducible2454940658
    script_test.go:156: 
        PATH=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-1625290363/tmpdir4100294628/testbin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/cache/tools/bin:/home/swarming/.swarming/w/ir/bbagent_utility_packages:/home/swarming/.swarming/w/ir/bbagent_utility_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages:/home/swarming/.swarming/w/ir/cipd_bin_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3/bin:/home/swarming/.swarming/w/ir/cache/cipd_client:/home/swarming/.swarming/w/ir/cache/cipd_client/bin:/home/swarming/.swarming/cipd_cache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        HOME=/no-home
        CCACHE_DISABLE=1
        GOARCH=amd64
...
        
        > [!buildmode:plugin] skip
        [condition not met]
        > [short] skip
        [condition not met]
        > go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go
        [stderr]
        -buildmode=plugin requires external (cgo) linking, but cgo is not enabled
    script_test.go:156: FAIL: testdata/script/build_plugin_reproducible.txt:4: go build -trimpath -buildvcs=false -buildmode=plugin -o a.so main.go: exit status 1
--- FAIL: TestScript/build_plugin_reproducible (0.09s)
2024-01-29 22:19 go1.22-linux-amd64-longtest release-branch.go1.22@117d7b10 cmd/go.TestScript/version_cshared (log)
=== RUN   TestScript/version_cshared
=== PAUSE TestScript/version_cshared
=== CONT  TestScript/version_cshared
    script_test.go:132: 2024-01-29T22:27:43Z
    script_test.go:134: $WORK=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-1625290363/tmpdir4100294628/version_cshared2860931925
go proxy: open /home/swarming/.swarming/w/ir/x/w/goroot/src/cmd/go/testdata/mod/example.com_v0.1.0.txt: no such file or directory
go proxy: no archive example.com v0.1.0: file does not exist
    script_test.go:156: 
        PATH=/home/swarming/.swarming/w/ir/x/t/cmd-go-test-1625290363/tmpdir4100294628/testbin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/x/w/goroot/bin:/home/swarming/.swarming/w/ir/cache/tools/bin:/home/swarming/.swarming/w/ir/bbagent_utility_packages:/home/swarming/.swarming/w/ir/bbagent_utility_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages:/home/swarming/.swarming/w/ir/cipd_bin_packages/bin:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3:/home/swarming/.swarming/w/ir/cipd_bin_packages/cpython3/bin:/home/swarming/.swarming/w/ir/cache/cipd_client:/home/swarming/.swarming/w/ir/cache/cipd_client/bin:/home/swarming/.swarming/cipd_cache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        HOME=/no-home
...
        go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
        go: added golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c
        go: added rsc.io/fortune v1.0.0
        go: added rsc.io/quote v1.5.2
        go: added rsc.io/sampler v1.3.0
        > go build -buildmode=c-shared -o external.so rsc.io/fortune
        [stderr]
        -buildmode=c-shared requires external (cgo) linking, but cgo is not enabled
    script_test.go:156: FAIL: testdata/script/version_cshared.txt:7: go build -buildmode=c-shared -o external.so rsc.io/fortune: exit status 1
--- FAIL: TestScript/version_cshared (0.32s)

watchflakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builders x/build issues (builders, bots, dashboards) GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: Done
Archived in project
Development

No branches or pull requests

3 participants