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

Mac OS Apple M1 get cpu info failed "no such file or directory" #1598

Closed
1 task done
Felixyang2088 opened this issue Feb 20, 2024 · 3 comments
Closed
1 task done

Mac OS Apple M1 get cpu info failed "no such file or directory" #1598

Felixyang2088 opened this issue Feb 20, 2024 · 3 comments

Comments

@Felixyang2088
Copy link

Felixyang2088 commented Feb 20, 2024

Describe the bug
Get cpu info failed , log info "no such file or directory"

To Reproduce

	cpuInfos, err := cpu.Info()
	if err != nil {
		logrus.Errorf("get cpu info failed : %v", err)
		//return
	}
	for _, ci := range cpuInfos {
		logrus.Infof("CPU: %+v", ci)
	}

Expected behavior
[A clear and concise description of what you expected to happen.]

Environment (please complete the following information):

  • Mac OS: Darwin GuangdeMacBook-Pro.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 arm64

Additional context
go env ░▒▓ ✔  base   12:12:25 
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/guangyang/Library/Caches/go-build'
GOENV='/Users/guangyang/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/guangyang/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/guangyang/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.21.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.0/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/yb/vy0wdpkx0jx6fyb7rmh1y5ph0000gn/T/go-build1627533097=/tmp/go-build -gno-record-gcc-switches -fno-common'

@shirou
Copy link
Owner

shirou commented Feb 21, 2024

You mean, cpu.Info() returns no such file or directory on the err return value? However, it seems cpu.info() does not read any files. Could you tell us which version of gopsutil you are using?

@dvovk
Copy link

dvovk commented Feb 21, 2024

Looks like I have the same issue "Error: no such file or directory" on version github.com/shirou/gopsutil v3.21.11+incompatible. This error returns for each call to unix.Sysctl in func InfoWithContext(ctx context.Context) ([]InfoStat, error)
I am testing on "M3 Max"

On github.com/shirou/gopsutil/v3 v3.24.1 this is info which I got
CPU:0 VendorID:"" Family:"0" Model:"0" Stepping:0 PhysicalID:"" CoreID:"" Cores:16 ModelName:"Apple M3 Max" Mhz:4056 CacheSize:0 Flags:[]string len: 0, cap: 0, nil Microcode:""

@Lomanic
Copy link
Collaborator

Lomanic commented Mar 2, 2024

Duplicate of #1000, update to /v3 (github.com/shirou/gopsutil/v3/cpu).

@Lomanic Lomanic closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants