google/gops

gops can not list process in Mac book with m1 chip

raochq opened this issue · 8 comments

gops program can not list the process which is build with cgo in M1 MacBook

example:

 ~ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/rao/Library/Caches/go-build"
GOENV="/Users/rao/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/rao/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/rao/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v5/jbb9crmn2gn5z__s2_pyybdh0000gn/T/go-build1597321378=/tmp/go-build -gno-record-gcc-switches -fno-common"
➜ ~ cat main.go
package main

import "C"

import (
	"fmt"
	"os"
	"os/signal"
)

func main() {
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Kill, os.Interrupt)
	<-c
	fmt.Println("exit")
}
➜  ~ go build main.go
➜  ~ ./main &
[1] 44211
➜  ~ gops
➜  ~

I have the same problem.a simple go project can be listed.but our complex one can‘t be listed :(

i have the same problem on my goland2021.3.4, but version 2020.3 is ok

I have a similar issue and I stepped through gops code and it appears goversion cannot read the version properly.

I am running go 1.18 on M1 mac.

Here is the issue I opened for goversion: rsc/goversion#24

The same thing happens to me here, no matter which go version I use 1.17.x or 1.18.x I have the same behavior as @giskook, a simple application is detected, but my actual complex application is not listed.

I tried installing go AMD64 instead of ARM ... the app built with the amd64 version could be detected, just doesn't work if the same app is built with the arm version of go !

I think #166 should fix this issues, at least when building gops using Go 1.18.

@raochq @giskook @zhuiyi9009 @abezzub @aymanrb could you please check whether gops built from latest master branch using Go 1.18 works as expected for you?

@tklauser I can confirm latest code from master detects the process that did not work before.

Thanks for confirming @abezzub!