deepflowio / deepflow

eBPF Observability - Distributed Tracing and Profiling
https://deepflow.io
Apache License 2.0
2.99k stars 334 forks source link

[BUG] compile error with cli #8553

Open Hyzhou opened 1 day ago

Hyzhou commented 1 day ago

Search before asking

DeepFlow Component

CLI Server

What you expected to happen

  1. CLI Build Error
ubuntu@VM-32-17-ubuntu:~/go/src/github.com/deepflowio/deepflow/cli$ make cli 
go mod tidy && go mod download && go mod vendor
cp -r ../message/* vendor/github.com/deepflowio/deepflow/message/
cp -r ../server/go.* vendor/github.com/deepflowio/deepflow/server/
find vendor -type d -exec chmod +w {} \;
cp vendor/github.com/deepflowio/deepflow/message/metric.proto vendor/github.com/deepflowio/deepflow/server/libs/flow-metrics/pb
cp vendor/github.com/deepflowio/deepflow/message/flow_log.proto vendor/github.com/deepflowio/deepflow/server/libs/datatype/pb
cp vendor/github.com/deepflowio/deepflow/message/stats.proto vendor/github.com/deepflowio/deepflow/server/libs/stats/pb
sed -i '6,10s/^...//' vendor/github.com/deepflowio/deepflow/server/libs/flow-metrics/pb/metric.proto
sed -i '6,10s/^...//' vendor/github.com/deepflowio/deepflow/server/libs/datatype/pb/flow_log.proto
sed -i '6,10s/^...//' vendor/github.com/deepflowio/deepflow/server/libs/stats/pb/stats.proto
cd vendor/github.com/deepflowio/deepflow/message && go generate ./...
cd vendor/github.com/deepflowio/deepflow/server/libs && go generate ./...
ambiguous import: found package github.com/deepflowio/deepflow/server/libs/logger/blocker in multiple modules:
        github.com/deepflowio/deepflow/server (/home/ubuntu/go/src/github.com/deepflowio/deepflow/cli/vendor/github.com/deepflowio/deepflow/server/libs/logger/blocker)
        github.com/deepflowio/deepflow/server/libs/logger/blocker v0.0.0-20240822020041-cdaf0f82ce6f (/home/ubuntu/go/src/github.com/deepflowio/deepflow/cli/vendor/github.com/deepflowio/deepflow/server/libs/logger/blocker)
make: *** [Makefile:28: vendor] Error 1
  1. Server Build Error:
go build -mod vendor -ldflags "-X main.Branch=main -X main.RevCount=11350 -X main.Revision=6759013a6f2953de8b6143f10646d7233c92dae3 -X main.CommitDate=2024-11-25 -X 'main.goVersion=go version go1.23.3 linux/amd64' -X 'main.CompileTime=2024-11-25 20:28:31'" -tags=go_json -o bin/deepflow-server cmd/server/main.go cmd/server/config.go cmd/server/free_os_memory_handler.go
# github.com/bytedance/sonic/loader
vendor/github.com/bytedance/sonic/loader/funcdata.go:37:32: undefined: _func
vendor/github.com/bytedance/sonic/loader/funcdata.go:74:12: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/funcdata.go:77:18: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/funcdata.go:188:28: undefined: compilationUnit
vendor/github.com/bytedance/sonic/loader/stubs.go:27:22: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:29:26: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:34:27: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:36:36: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:46:21: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:50:22: undefined: moduledata
vendor/github.com/bytedance/sonic/loader/stubs.go:50:22: too many errors
# github.com/grafana/pyroscope-go/godeltaprof/internal/pprof
vendor/github.com/grafana/pyroscope-go/godeltaprof/internal/pprof/delta_mutex.go:25:20: undefined: runtime_cyclesPerSecond
vendor/github.com/grafana/pyroscope-go/godeltaprof/internal/pprof/proto.go:400:8: undefined: runtime_expandFinalInlineFrame
make: *** [Makefile:120: server] Error 1

因为我使用了Go 1.23进行编译,而基础库github.com/bytedance/sonic不支持。 升级基础库之后编译失败,我可以退回更低版本的go进行编译,官方是不是可以评估一下这个库能否支持升级? go get -u github.com/bytedance/sonic@v1.12.5

How to reproduce

No response

DeepFlow version

main

DeepFlow agent list

No response

Kubernetes CNI

No response

Operation-System/Kernel version

No response

Anything else

No response

Are you willing to submit a PR?

Code of Conduct

lzf575 commented 10 hours ago

sonic 已更新

Hyzhou commented 10 hours ago

sonic 已更新

第一个CLI的编译问题,能不能也帮忙看一下。 第二个在高版本1.23 Go环境编译的问题并没有得到解决。

go build -mod vendor -ldflags "-X main.Branch=main -X main.RevCount=11354 -X main.Revision=98d8f792179551657a971c611da3b97d510053bb -X main.CommitDate=2024-11-26 -X 'main.goVersion=go version go1.23.3 linux/amd64' -X 'main.CompileTime=2024-11-26 15:20:14'" -tags=go_json -o bin/deepflow-server cmd/server/main.go cmd/server/config.go cmd/server/free_os_memory_handler.go
# github.com/grafana/pyroscope-go/godeltaprof/internal/pprof
vendor/github.com/grafana/pyroscope-go/godeltaprof/internal/pprof/delta_mutex.go:25:20: undefined: runtime_cyclesPerSecond
vendor/github.com/grafana/pyroscope-go/godeltaprof/internal/pprof/proto.go:400:8: undefined: runtime_expandFinalInlineFrame

https://github.com/grafana/pyroscope-go 的依赖版本也低了,需要升级才能够支持 。