You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version devel +cbce223 Fri Jun 29 17:44:10 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
linux/amd64
What did you do?
I attempted to compile the following toy program
# t.gopackage main
// void foo(void) {}import"C"funcmain() {
C.foo();
}
with this command:
$ CGO_CFLAGS=-g1 go build
What did you expect to see?
A working program with minimal debug information.
What did you see instead?
A compilation failure:
# github.com/benesch/t
./t.go:7:2: call of non-function C.foo
Seems like cgo really needs debug information to be available. The problem changes with -g0:
$ CGO_CFLAGS=-g0 go build
# github.com/benesch/t
cannot load DWARF output from $WORK/b001//_cgo_.o: decoding dwarf section info at offset 0x0: too short
I don't particularly care if cgo silently upgrades the amount of debugging where necessary—or outright rejects -g0 and -g1. I just accidentally stumbled across this while trying to plumb some flags for msan through CockroachDB's C/C++ dependencies and it took a while to figure out what had gone wrong.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +cbce223 Fri Jun 29 17:44:10 2018 +0000 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/amd64
What did you do?
I attempted to compile the following toy program
with this command:
What did you expect to see?
A working program with minimal debug information.
What did you see instead?
A compilation failure:
Seems like cgo really needs debug information to be available. The problem changes with
-g0
:I don't particularly care if cgo silently upgrades the amount of debugging where necessary—or outright rejects -g0 and -g1. I just accidentally stumbled across this while trying to plumb some flags for msan through CockroachDB's C/C++ dependencies and it took a while to figure out what had gone wrong.
/cc @ianlancetaylor
The text was updated successfully, but these errors were encountered: