berops / claudie

Cloud-agnostic managed Kubernetes
https://docs.claudie.io/
Apache License 2.0
521 stars 34 forks source link

Chore: Unable to compile claudie from source in WSL2 ubuntu 22.04 #1423

Open abhisekp-rcc opened 1 week ago

abhisekp-rcc commented 1 week ago

Description

Unable to compile claudie from source in WSL2 ubuntu 22.04

Exit criteria

When I try to build using make crd, it throws with this error.

Versions

▶ go version
go version go1.22.4 linux/amd64
▶ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

Error

▶ make crd
/mnt/c/Users/abhis/GitRepos/claudie/bin/controller-gen rbac:roleName=manager-role crd paths="./..." output:crd:artifacts:config=manifests/claudie/crd
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa08fef]

goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc000798600, 0xc001b7ab10)
        /usr/local/go/src/go/types/check.go:367 +0x88
panic({0xbc4180?, 0x12acc20?})
        /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdbc8f8, 0x12b53a0})
        /usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdbc8f8?, 0x12b53a0?})
        /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdc2c70, 0x1281530}, 0xc000798600, 0x12b53a0, 0xc001b78588)
        /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000798600, 0xc0005df940, 0x12b53a0)
        /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000798600, 0xc0005df940, {0xdbc8f8, 0x12b53a0})
        /usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc000798600, 0xc0005df940, {0xdbc8f8, 0x12b53a0})
        /usr/local/go/src/go/types/const.go:289 +0x3f
go/types.(*Checker).isValidIndex(0xc000798600, 0xc0005df940, 0x34, {0xc87add, 0x5}, 0x0)
        /usr/local/go/src/go/types/index.go:384 +0x86
go/types.(*Checker).index(0xc000798600, {0xdc0fa8, 0xc000fff6e0}, 0xffffffffffffffff)
        /usr/local/go/src/go/types/index.go:355 +0xc6
go/types.(*Checker).builtin(0xc000798600, 0xc0005df880, 0xc000a7dbc0, 0x9)
        /usr/local/go/src/go/types/builtins.go:517 +0x62f6
go/types.(*Checker).callExpr(0xc000798600, 0xc0005df880, 0xc000a7dbc0)
        /usr/local/go/src/go/types/call.go:236 +0xf85
go/types.(*Checker).exprInternal(0xc000798600, 0x0, 0xc0005df880, {0xdc1068, 0xc000a7dbc0}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1374 +0xf8
go/types.(*Checker).rawExpr(0xc000798600, 0x0, 0xc0005df880, {0xdc1068?, 0xc000a7dbc0?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000798600, 0x0?, 0xc0005df880, {0xdc1068?, 0xc000a7dbc0?})
        /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).varDecl(0xc000798600, 0xc001acf4a0, {0xc0019169a0, 0x1, 0x1}, {0x0, 0x0}, {0xdc1068, 0xc000a7dbc0})
        /usr/local/go/src/go/types/decl.go:521 +0x17b
go/types.(*Checker).objDecl(0xc000798600, {0xdc85a0, 0xc001acf4a0}, 0x0)
        /usr/local/go/src/go/types/decl.go:194 +0x9e5
go/types.(*Checker).packageObjects(0xc000798600)
        /usr/local/go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc000798600, {0xc00039c070, 0xd, 0xd})
        /usr/local/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        /usr/local/go/src/go/types/check.go:372
sigs.k8s.io/controller-tools/pkg/loader.(*loader).typeCheck(0xc00037daa0, 0xc0000fb040)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/loader/loader.go:286 +0x36a
sigs.k8s.io/controller-tools/pkg/loader.(*Package).NeedTypesInfo(0xc0000fb040)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/loader/loader.go:99 +0x39
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).check(0xc001aa7c20, 0xc0000fb040)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/loader/refs.go:268 +0x2b7
sigs.k8s.io/controller-tools/pkg/loader.(*TypeChecker).Check(...)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/loader/refs.go:216
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).AddPackage(0xc00196a540, 0xc0000fb040)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/crd/parser.go:224 +0xfd
sigs.k8s.io/controller-tools/pkg/crd.(*Parser).NeedPackage(0xc00196a540, 0xc0000fb040)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/crd/parser.go:242 +0xee
sigs.k8s.io/controller-tools/pkg/crd.Generator.Generate({0x0, 0x0, 0x0, {0x0, 0x0, 0x0}, 0x0}, 0xc001a882d0)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/crd/gen.go:109 +0x15b
sigs.k8s.io/controller-tools/pkg/genall.(*Runtime).Run(0xc001001680)
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/pkg/genall/genall.go:261 +0x23d
main.main.func1(0xc00035e100?, {0xc00037b880?, 0x4?, 0xc87260?})
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/cmd/controller-gen/main.go:176 +0x6a
github.com/spf13/cobra.(*Command).execute(0xc00017b808, {0xc000118060, 0x4, 0x4})
        /home/abhisekp/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x882
github.com/spf13/cobra.(*Command).ExecuteC(0xc00017b808)
        /home/abhisekp/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /home/abhisekp/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968
main.main()
        /home/abhisekp/go/pkg/mod/sigs.k8s.io/controller-tools@v0.11.3/cmd/controller-gen/main.go:200 +0x2f6
make: *** [Makefile:128: crd] Error 2
cloudziu commented 4 days ago

Hello @abhisekp-rcc I had the same issue, but I've manage to fix it. Remove the ./bin/controller-gen In the Makefile edit:

--- a/Makefile
+++ b/Makefile
@@ -121,7 +121,7 @@ $(LOCALBIN):

 ## Tool Binaries
 CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
-CONTROLLER_TOOLS_VERSION ?= v0.11.3
+CONTROLLER_TOOLS_VERSION ?= v0.14.0

 # Generate CustomResourceDefinition objects.
 crd: controller-gen

Try running make crd again.

My environment is also WSL, go is in version go version go1.22.4 linux/amd64.