英文:
"no debug info in ELF executable errno" when running a binary built with gccgo
问题
我决定尝试一下Go语言,于是写了下面这段代码:
package main
import "fmt"
func main() {
fmt.Printf("Hello, World\n")
}
我将它保存为main.go
,然后尝试使用gccgo main.go -o main
进行编译。这一步成功了。然而,当我尝试运行./main
时,我得到了以下错误信息:
no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable
runtime stack:
no debug info in ELF executable errno -1
panic during panic
到底发生了什么?
英文:
I decided to give Go a try, and thus wrote the following bit of code:
package main
import "fmt"
func main() {
fmt.Printf("Hello, World\n")
}
I saved that under main.go
, and then tried to compile it using gccgo main.go -o main
. This worked. However, when I tried ./main
, I got the following message:
no debug info in ELF executable errno -1
fatal error: no debug info in ELF executable
runtime stack:
no debug info in ELF executable errno -1
panic during panic
What on earth happened?
答案1
得分: 4
首先,不要使用gccgo,它不支持Go 1.3。
其次,Go的运行时依赖于调试信息,我猜你正在使用一个较旧的gcc版本(可能是4.8),它会自动剥离调试信息,你需要像这样运行它:gccgo -g main.go -o main
。
如果你正在使用Ubuntu,这个bug是相关的。
英文:
First, don't use gccgo, it doesn't support Go 1.3.
Second, Go's runtime depends on debug information, which I'm guessing you're using an older version of gcc (probably 4.8) which automaticlly strips it, you would have to run it like gccgo -g main.go -o main
.
If you're using ubuntu, this bug is relevant.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论