"no debug info in ELF executable errno" when running a binary built with gccgo

huangapple go评论78阅读模式
英文:

"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.

huangapple
  • 本文由 发表于 2014年8月1日 21:58:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/25081943.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定