-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: NumGoroutine is 2 in main when using -linkshared #16631
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
Comments
I'd previously said that this happened with 1.6 but it doesn't, this is a regression (sadface). |
Ah so the good news is that this is because the test is a bit silly (in a way that it is not in 1.6). And this is the real 'problem':
This difference is present in 1.6 so not a regression. I'll either try to figure out what's going on or just fix the test in early 1.8. |
@mwhudson Do we need to skip the test in 1.7? |
It's not run by default, so I'd say no. |
@mwhudson, I probably just don't know what I'm doing here, but when I tried to reproduce this I get: $ go run -linkshared main.go
# command-line-arguments
/home/austin/go.dev/pkg/tool/linux_amd64/link: cannot implicitly include runtime/cgo in a shared library I tried |
@aclements you need to run go install -buildmode=shared std first |
Although the -linshared is probably irrelevant, it happens just when linking externally:
|
Thanks. It looks like the "second" goroutine is the spare M used by cgo callbacks. So this will appear whenever cgo is used. Perhaps that should be marked as a system goroutine until it's actually used... |
CL https://golang.org/cl/45030 mentions this issue. |
Please answer these questions before submitting your issue. Thanks!
go version
)?go version devel +219ca60 Sat Aug 6 19:30:57 2016 +0000 linux/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/opensource/gopath"
GORACE=""
GOROOT="/opt/opensource/go"
GOTOOLDIR="/opt/opensource/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build374916367=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
go run run.go -linkshared goprint.go
no output but the process exiting cleanly
it hangs
The text was updated successfully, but these errors were encountered: