Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.2下载的可执行文件启动失败:cgroup cpu init failed!err:=not implemented yet #55

Open
lishuhao opened this issue Jan 6, 2020 · 3 comments

Comments

@lishuhao
Copy link

lishuhao commented Jan 6, 2020

下载的可执行文件启动失败

👉  discovery git:(master) ✗ ./discovery_1.1.2_Darwin_x86_64 -conf=discovery-examp.toml                            
panic: cgroup cpu init failed!err:=not implemented yet

goroutine 1 [running]:
github.com/bilibili/kratos/pkg/stat/sys/cpu.init.0()
        /Users/felix/work/go/pkg/mod/github.com/bilibili/[email protected]/pkg/stat/sys/cpu/cpu.go:33 +0x189
👉  ~ go version
go version go1.13 darwin/amd64


👉  ~ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/hao/Documents/go/bin"
GOCACHE="/Users/hao/Library/Caches/go-build"
GOENV="/Users/hao/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="git.xxwolo.com"
GONOSUMDB="git.xxwolo.com"
GOOS="darwin"
GOPATH="/Users/hao/Documents/go"
GOPRIVATE="git.xxwolo.com"
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/Cellar/go/1.13/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/59/tmvyr0md5tj_5htf68fs85dm0000gn/T/go-build381810701=/tmp/go-build -gno-record-gcc-switches -fno-common"

@hoseadevops
Copy link

遇到了类似的错误

(在GOPATH 下通过readme可以正常编译运行 在 module 模式下编译通过 运行报:cgroup cpu init failed 巴拉巴拉...)

kernel version uname -a

Darwin MacBook-Air.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64

go version

go version go1.14 darwin/amd64

go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hosea/Library/Caches/go-build"
GOENV="/Users/hosea/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Volumes/work/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/local/Cellar/go/1.14/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Volumes/work/go-modules/discovery/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4f/jhwdw_tn0w34shrr8mphzm9h0000gp/T/go-build902568572=/tmp/go-build -gno-record-gcc-switches -fno-common"

运行 make

make build
make run 

// 报错
panic: cgroup cpu init failed!err:=not implemented yet

goroutine 1 [running]:
github.com/bilibili/kratos/pkg/stat/sys/cpu.init.0()
	/Volumes/work/go/pkg/mod/github.com/bilibili/[email protected]/pkg/stat/sys/cpu/cpu.go:33 +0x188`

取消 makefile 文件中 CGO_ENABLED=0 后问题消失

make build
make run 

curl 'http://127.0.0.1:7171/discovery/register' -d "zone=sh1&env=test&appid=provider&hostname=myhostname&status=1&addrs=http%3A%2F%2F172.1.1.1%3A8000&addrs=grpc%3A%2F%2F172.1.1.1%3A9999&version=111&metadata=%7B%22weight%22%3A10%7D

{"code":0,"message":"0","ttl":1}

刚从其他语言转到go 想通过goim 以及 bilibili 开源项目 提升下自己 ,还没深入 CGO_ENABLED 配置项作用

@lintanghui
Copy link
Member

应该是和这个一样 go-kratos/kratos#136 可以升级下kratos依赖看看

@yangyanqing
Copy link

mac 下才有的问题,Linux 没有,试了 kratos v1.0.0、v0.6.0、v0.5.0、v0.4.2、v0.4.1 … 都不行
用 docker 或者 Linux 下跑吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants