Open
Description
Bug Report
We noticed that pulling the kcl cli binary from the releases and putting it inside an Alpine image results in an error. A call to kcl
itself correctly prints a help message but doing something like kcl somefile.k
results in an error concerning a shared library. I assume kcl depends on some libc component which leads to this issue.
I am aware that there is an open issue concerning a musl build of kcl but IMHO a static build should suffice for this use case.
1. Minimal reproduce step (Required)
- Create an Alpine container/VM.
- Put the latest kcl binary and a sample kcl file inside.
- Run
kcl sample.k
2. What did you expect to see? (Required)
I expected to see the resulting YAML
3. What did you see instead (Required)
panic: Error relocating /home/benedikt/.cache/kcl/libkclvm_cli_cdylib.so: __res_init: symbol not found
goroutine 1 [running]:
kcl-lang.io/lib/go/native.initClient.func1()
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/go/native/client.go:41 +0x145
sync.(*Once).doSlow(0x41a365?, 0x30?)
/home/linuxbrew/.linuxbrew/Cellar/go/1.24.2/libexec/src/sync/once.go:78 +0xab
sync.(*Once).Do(...)
/home/linuxbrew/.linuxbrew/Cellar/go/1.24.2/libexec/src/sync/once.go:69
kcl-lang.io/lib/go/native.initClient(0xc0004f5568?)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/go/native/client.go:38 +0x3a
kcl-lang.io/lib/go/native.NewNativeServiceClientWithPluginAgent(...)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/go/native/client.go:62
kcl-lang.io/lib/go/native.NewNativeServiceClient(...)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/go/native/client.go:58
kcl-lang.io/kcl-go/pkg/kcl.Service(...)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/kcl/service.go:10
kcl-lang.io/kcl-go/pkg/kcl.runWithHooks({0xc0004f5568, 0x0, 0x0}, {0x4a9a320, 0x1, 0x1}, {0xc0004f5638, 0x1, 0x1})
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/kcl/api.go:436 +0x15f
kcl-lang.io/kcl-go/pkg/kcl.run(...)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/kcl/api.go:445
kcl-lang.io/kcl-go/pkg/kcl.RunWithOpts({0xc0004f5638?, 0xc0001bd140?, 0xc0004f56c8?})
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/kcl/api.go:372 +0x45
kcl-lang.io/kpm/pkg/client.(*KpmClient).Run.func1(0xc0001bd140)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/client/run.go:666 +0x3aa
kcl-lang.io/kpm/pkg/visitor.(*PkgVisitor).Visit(0xc0008890b0, 0xc0000cf7e0, 0xc0006aa840)
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/visitor/visitor.go:60 +0xea
kcl-lang.io/kpm/pkg/client.(*KpmClient).Run(0xc0004f7180, {0xc0004f5980, 0xe, 0xc0004f5870?})
/home/benedikt/go/pkg/mod/kcl-lang.io/[email protected]/pkg/client/run.go:641 +0x20b
kcl-lang.io/cli/pkg/options.(*RunOptions).Run(0xc000819680)
/home/benedikt/Code/work/kcl-cli/pkg/options/run.go:154 +0x9f9
kcl-lang.io/cli/cmd/kcl/commands.NewRunCmd.func1(0xc0004f8800?, {0xc0001263c0?, 0x4?, 0x23f97dc?})
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/run.go:73 +0x49
github.com/spf13/cobra.(*Command).execute(0xc0004c1508, {0xc0000501f0, 0x1d, 0x1d})
/home/benedikt/go/pkg/mod/github.com/spf13/[email protected]/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004c1508)
/home/benedikt/go/pkg/mod/github.com/spf13/[email protected]/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(...)
/home/benedikt/go/pkg/mod/github.com/spf13/[email protected]/command.go:1071
kcl-lang.io/cli/cmd/kcl/commands.executeRunCmd({0xc0000501f0, 0x1d, 0x1d})
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/plugin.go:17 +0x73
kcl-lang.io/cli/cmd/kcl/commands.bootstrapCmdPlugin(0xc00045d208?, {0x29d0118, 0xc000889038})
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/plugin.go:67 +0x3c5
kcl-lang.io/cli/cmd/kcl/commands.NewWithNameAndCommands({0x23f8ce8, 0x3}, {0x0, 0x0, 0x0?})
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/root.go:150 +0x3c9
kcl-lang.io/cli/cmd/kcl/commands.NewWithName(...)
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/root.go:104
kcl-lang.io/cli/cmd/kcl/commands.New(...)
/home/benedikt/Code/work/kcl-cli/cmd/kcl/commands/root.go:99
main.main()
/home/benedikt/Code/work/kcl-cli/cmd/kcl/main.go:14 +0x2b
4. What is your KCL components version? (Required)
kcl version 0.11.1-linux-amd64