dundee / gdu

Fast disk usage analyzer with console interface written in Go
MIT License
3.94k stars 142 forks source link

external (cgo) linking - failure to build groupcache #310

Closed daniejstriata closed 4 months ago

daniejstriata commented 8 months ago

When building gdu 5.26.0 in COPR for the various rpm distros, the Fedora Rawhide builds fail with the error snip below. (All the other distros builds) I set the go build command like: GO111MODULE=on CGO_ENABLED=0 go build \

Is groupcache requiring cgo on newer versions of go? Should I enable cgo for all builds or only Rawhide?

go: downloading github.com/cespare/xxhash v1.1.0
go: downloading github.com/klauspost/compress v1.12.3
go: downloading golang.org/x/net v0.0.0-20220722155237-a158d28d115b
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: downloading github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6
-linkmode=external requires external (cgo) linking, but cgo is not enabled
error: Bad exit status from /var/tmp/rpm-tmp.XO7oTi (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.XO7oTi (%build)
Finish: rpmbuild gdu-5.26.0-1.fc40.src.rpm
Finish: build phase for gdu-5.26.0-1.fc40.src.rpm
INFO: chroot_scan: 1 files copied to /var/lib/copr-rpmbuild/results/chroot_scan
INFO: /var/lib/mock/fedora-rawhide-aarch64-1707806942.943790/root/var/log/dnf5.log
ERROR: Exception(/var/lib/copr-rpmbuild/results/gdu-5.26.0-1.fc40.src.rpm) Config(fedora-rawhide-aarch64) 0 minutes 20 seconds
INFO: Results and/or logs in: /var/lib/copr-rpmbuild/results
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot
dundee commented 8 months ago

I think you need to remove -linkmode=external from gdu.spec. CGO is not used by Gdu or it's dependencies and should be disabled.