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

gops can not list process in Mac book with m1 chip #160

Closed
raochq opened this issue Jan 10, 2022 · 8 comments
Closed

gops can not list process in Mac book with m1 chip #160

raochq opened this issue Jan 10, 2022 · 8 comments

Comments

@raochq
Copy link

raochq commented Jan 10, 2022

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
➜  ~
@giskook
Copy link

giskook commented Feb 17, 2022

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

@zhuiyi9009
Copy link

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

@abezzub
Copy link

abezzub commented Apr 2, 2022

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.

@abezzub
Copy link

abezzub commented Apr 2, 2022

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

@aymanrb
Copy link

aymanrb commented Apr 13, 2022

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 !

tklauser added a commit that referenced this issue May 4, 2022
Use package debug/buildinfo [1] introduced in Go 1.18 [2] when possible.
This should avoid previous issues with rsc.io/goversion where Go
processes were no longer listed.

[1] https://pkg.go.dev/debug/buildinfo
[2] https://go.dev/doc/go1.18#debug/buildinfo

For #102
For #159
For #160
tklauser added a commit that referenced this issue May 4, 2022
Use package debug/buildinfo [1] introduced in Go 1.18 [2] when possible.
This should avoid previous issues with rsc.io/goversion where Go
processes were no longer listed.

[1] https://pkg.go.dev/debug/buildinfo
[2] https://go.dev/doc/go1.18#debug/buildinfo

For #102
For #159
For #160
@tklauser
Copy link
Collaborator

tklauser commented May 4, 2022

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?

@abezzub
Copy link

abezzub commented May 5, 2022

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

@tklauser
Copy link
Collaborator

tklauser commented May 6, 2022

Thanks for confirming @abezzub!

@tklauser tklauser closed this as completed May 6, 2022
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

6 participants