lxc/distrobuilder

Failed at the 'make' step; make: *** [Makefile:9: default] Error 2

00gh opened this issue · 3 comments

00gh commented

Today tried to make the distrobuilder, per the given instructions, but it failed at the 'make' step.
[commit: b8491c1]

Looks like old(er) references to `lxc/incus (v0.0.0)?

Maybe there is a similar issue with klauspost/compress?

Only the errors in the 'make' step are given below:

X@distrobuilder:~/go/src/github.com/lxc/distrobuilder$ make
gofmt -s -w .
go install -v ./...
github.com/klauspost/compress/zstd
github.com/lxc/incus/shared/simplestreams
github.com/lxc/incus/shared/tls
# github.com/lxc/incus/shared/simplestreams
../../../../pkg/mod/github.com/lxc/incus@v0.0.0-20231108042213-fae14b9e604f/shared/simplestreams/simplestreams.go:102:18: undefined: url.JoinPath
../../../../pkg/mod/github.com/lxc/incus@v0.0.0-20231108042213-fae14b9e604f/shared/simplestreams/simplestreams.go:167:20: undefined: url.JoinPath
note: module requires Go 1.20
# github.com/lxc/incus/shared/tls
../../../../pkg/mod/github.com/lxc/incus@v0.0.0-20231108042213-fae14b9e604f/shared/tls/cert.go:89:19: undefined: x509.ParseRevocationList
note: module requires Go 1.20
# github.com/klauspost/compress/zstd
../../../../pkg/mod/github.com/klauspost/compress@v1.17.2/zstd/dict.go:479:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../../../pkg/mod/github.com/klauspost/compress@v1.17.2/zstd/dict.go:490:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../../../pkg/mod/github.com/klauspost/compress@v1.17.2/zstd/dict.go:491:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
../../../../pkg/mod/github.com/klauspost/compress@v1.17.2/zstd/dict.go:492:32: binary.LittleEndian.AppendUint32 undefined (type binary.littleEndian has no field or method AppendUint32)
make: *** [Makefile:9: default] Error 2
X@distrobuilder:~/go/src/github.com/lxc/distrobuilder$

Thanks in advance.

The error message is reasonably clear module requires Go 1.20.

You're most likely running a Linux distribution where the Go version is something prior to Go 1.20.

You may be able to install a packaged version of a more recent Go, or you can go on the Go website and grab the latest stable version from there. https://go.dev/doc/install

00gh commented

Thanks for the quick answer. You were right.


Using Ubuntu 22.04 (in an *incus* container :) has a lower go version (1.18) after al the given steps.

Add the go 1.20 version and change the Makefile to use it.

apt-get install golang-1.20-go 

Add PATH in the Makefile to find the 1.20 version first.

--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ VERSION=$(shell grep "var Version" shared/version/version.go | cut -d'"' -f2)
 ARCHIVE=distrobuilder-$(VERSION).tar
 GO111MODULE=on
 SPHINXENV=.sphinx/venv/bin/activate
+PATH := /usr/lib/go-1.20/bin/:$(PATH)

 .PHONY: default
 default: