gopsutil icon indicating copy to clipboard operation
gopsutil copied to clipboard

Builds for netbsd arm fail with `undefined: cpuTimes`

Open hdm opened this issue 1 year ago • 4 comments

Describe the bug

NetBSD builds on ARM started to failed after version 3.23.8

To Reproduce

env GOOS=netbsd GOARCH=arm go build ...
# github.com/shirou/gopsutil/v3/cpu
../../../pkg/mod/github.com/shirou/gopsutil/[email protected]/cpu/cpu_netbsd.go:45:14: undefined: cpuTimes
../../../pkg/mod/github.com/shirou/gopsutil/[email protected]/cpu/cpu_netbsd.go:70:14: undefined: cpuTimes

Expected behavior

Successful builds of netbsd/arm targets

hdm avatar May 09 '24 19:05 hdm

netbsd/arm has never been supported, this was just falling back to the functions returning a common.ErrNotImplementedError in cpu/cpu_fallback.go before #1530.

Please report back if copying cpu/cpu_openbsd_arm.go to cpu/cpu_netbsd_arm.go fixes the issue, it should build but check if it returns coherent results.

Lomanic avatar May 09 '24 23:05 Lomanic

@Lomanic Thanks for the quick reply! That does resolve the build error. In my case the fallback error was preferable to a build failure (or nonsense results). I haven't been able to test this on a recent NetBSD to confirm.

hdm avatar May 11 '24 22:05 hdm

Does this mean that you have confirmed that cpu_netbsd_arm.go copied from cpu_openbsd_arm.go works fine? If so, we can make a PR to add that file. This will avoid build failures.

shirou avatar May 13 '24 14:05 shirou

Switching to the previous fallback method would resolve this, but I haven't had a chance to review the results on NetBSD. The bigger issue is the build failure (rather than support for the OS).

hdm avatar May 13 '24 14:05 hdm